Forum Moderators: open

Message Too Old, No Replies

JavaScript for placing cursor on form field

How to do it?

         

Nick_W

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

WebmasterWorld Senior Member 10+ Year Member



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

ukgimp

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

WebmasterWorld Senior Member 10+ Year Member



Hi Nick

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

[idocs.com...]

Richard

luma

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

10+ Year Member



This is basically what google uses:
<html><head>
<script>
<!--
function sf(){document.f.q.focus();}
// -->
</script>
</head>
<body onLoad=sf()></body>
</html>

Nick_W

1:26 pm on Jun 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

Nick