Jump to content

[SOLVED] focas cursor to end of text


didgydont

Recommended Posts

hi all

i have been able to put the cursor in the box i want but as i type it puts the cursor at the start of the text not the end does anyone know how to solve this ? thank you ..

    <html>
  <head>
  <title>Test Price List</title>
  <link rel="stylesheet" type="text/css" href="admin/site.css" />
  <script>
function sf(){document.searcharea.itemsearch.focus()}
  </script>
  </head>
  <body onload="sf()">
                 <?php

include("admin/connect.php");
include("toolbar.php");



$typesearch = @"$_POST[typesearch]" ;
$itemsearch = @"$_POST[itemsearch]" ;

echo "
<table border='0' cellpadding='5' cellspacing='0'>
<form action='index.php' method='post' name='searcharea'>
<tr><td>Item Description:</td><td><input type='text' title='Type The Name Of The Item' name='itemsearch' value='$itemsearch' class='TEXTB' onkeyup='this.form.submit()' /></td>
<td>Type: </td><td><select type='text' name='typesearch' class='SELECTA' id='typesearch' title='Select The Item Type' onchange='this.form.submit()' />
<option value='$typesearch'>$typesearch &nbsp&nbsp (current)</option>
<option value='All Items'>All Items</option>";
include("admin/type.php");
echo "</select></td>
<td></td><td></td></tr>
</form></table><br /><br />";

Link to comment
Share on other sites

this solved my problem

  <html>
  <head>
  <title>Test Price List</title>
  <link rel="stylesheet" type="text/css" href="admin/site.css" />
  <script>
function sf(){document.searcharea.itemsearch.focus()}
function setCaretToEnd (el) {
  if (el.createTextRange) {
    var v = el.value;
    var r = el.createTextRange();
    r.moveStart('character', v.length);
    r.select();
  }
}
function insertAtEnd (el, txt) {
  el.value += txt;
  setCaretToEnd (el);
}


</script>
  </head>
  <body onload="sf();setCaretToEnd(document.searcharea.itemsearch);">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.