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
https://forums.phpfreaks.com/topic/111491-solved-focas-cursor-to-end-of-text/
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);">

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.