didgydont Posted June 23, 2008 Share Posted June 23, 2008 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    (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 />"; Quote Link to comment https://forums.phpfreaks.com/topic/111491-solved-focas-cursor-to-end-of-text/ Share on other sites More sharing options...
MadTechie Posted June 23, 2008 Share Posted June 23, 2008 This is a Javascript problem NOT a PHP one Quote Link to comment https://forums.phpfreaks.com/topic/111491-solved-focas-cursor-to-end-of-text/#findComment-572208 Share on other sites More sharing options...
didgydont Posted June 24, 2008 Author Share Posted June 24, 2008 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);"> Quote Link to comment https://forums.phpfreaks.com/topic/111491-solved-focas-cursor-to-end-of-text/#findComment-573211 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.