Welcome to WebmasterWorld Guest from 23.22.220.37

Forum Moderators: open

Message Too Old, No Replies

JavaScript for placing cursor on form field

How to do it?

     
8:35 am on Jun 28, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 4, 2002
posts:5044
votes: 0


Hi all

If I have a search box on a page, how might I use JS to put the cursor on it?

I'm afraid JS is not really one of my strong points ;)

Nick

8:57 am on June 28, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 6, 2001
posts:2213
votes: 0


Hi Nick

take a look at this, i think it is what you are looking for

[idocs.com...]

Richard

1:19 pm on June 28, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 20, 2002
posts:194
votes: 0


This is basically what google uses:
<html><head>
<script>
<!--
function sf(){document.f.q.focus();}
// -->
</script>
</head>
<body onLoad=sf()></body>
</html>
1:26 pm on June 28, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 4, 2002
posts:5044
votes: 0


Thanks ukgimp, quite simple really, time I got round to reading the 'definitive guide' JS book my mum got me last B'day!

Nick