Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

textarea & cursor 1

Status
Not open for further replies.

Andy6666uk

Programmer
Jul 11, 2001
17
GB
hi

can you tell me how to get the cursor to go to the top left corner of a textarea when it is clicked in, at the moment the cursor, in my textarea, stays where you click.

thanks andy.
 
Hi Andy,

I don't know how to do it with "onclick" but I know a solution with "onmouseover"

<script language=&quot;javascript&quot;>

function topleft()
{
document.formname.textareaname.focus();
}
</script>


<form method=&quot;post&quot; name=&quot;formname&quot;>
<textarea onclick=&quot;javascript:topleft();&quot; rows=&quot;5&quot; cols=&quot;70&quot; name=&quot;textareaname&quot;>your text</textarea>
</form>

Erik

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top