Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-06-2007, 05:35 PM   PM User | #1
wayne3503
Regular Coder

 
Join Date: Jul 2007
Posts: 108
Thanks: 0
Thanked 2 Times in 2 Posts
wayne3503 is an unknown quantity at this point
Stupid question

Ok this is a stupid question but I am drawing a blank and im sure it is HTML related and not JS. Anyway what I am trying to remember is, how do I set the cursor to be in a text box in a form when the page loads?
Thanks alot for the help
wayne3503 is offline   Reply With Quote
Old 08-06-2007, 06:36 PM   PM User | #2
coothead
Senior Coder

 
coothead's Avatar
 
Join Date: Jan 2004
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 1,546
Thanks: 0
Thanked 195 Times in 191 Posts
coothead will become famous soon enough
Hi there wayne3503,

does this help...
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">
window.onload=function() {
   document.forms[0][0].focus();
 }
</script>

</head>
<body>

<form action="#">
<div>
<input type="text"/>
</div>
</form>

</body>
</html>
coothead
coothead is offline   Reply With Quote
Old 08-06-2007, 07:12 PM   PM User | #3
wayne3503
Regular Coder

 
Join Date: Jul 2007
Posts: 108
Thanks: 0
Thanked 2 Times in 2 Posts
wayne3503 is an unknown quantity at this point
OMG coot can I not get rid of you? Not that I want to, this is crazy8 thanks coot....again
wayne3503 is offline   Reply With Quote
Old 08-06-2007, 07:23 PM   PM User | #4
coothead
Senior Coder

 
coothead's Avatar
 
Join Date: Jan 2004
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 1,546
Thanks: 0
Thanked 195 Times in 191 Posts
coothead will become famous soon enough
Hi there wayne3503 a.k.a. crazy8,
Quote:
...can I not get rid of you?
You could try putting out a contract on me?
Don't you know anyone from the mob?

coothead
coothead is offline   Reply With Quote
Old 08-06-2007, 07:26 PM   PM User | #5
wayne3503
Regular Coder

 
Join Date: Jul 2007
Posts: 108
Thanks: 0
Thanked 2 Times in 2 Posts
wayne3503 is an unknown quantity at this point
actually...in highschool i knew a student who was in russsian mob....anyway thank you for the help ill give it a try and see if it helps. It does look like what i think I need. The sad thing is I have done it before and cant find the code where I thought I had used it.
Though I thought it was something that got inserted into the <body> tag. Guess I was wrong...
wayne3503 is offline   Reply With Quote
Old 08-06-2007, 07:42 PM   PM User | #6
coothead
Senior Coder

 
coothead's Avatar
 
Join Date: Jan 2004
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 1,546
Thanks: 0
Thanked 195 Times in 191 Posts
coothead will become famous soon enough
Hi there crazy Wayne,
Quote:
I thought it was something that got inserted into the <body> tag. Guess I was wrong.
No, you were not wrong.
It is just better practice to remove to remove javascript event handlers from the markup.

coothead

p.s. I will have to keep my open for Russians from now on. Don't seem to get that many in my neck of the woods, though.
coothead is offline   Reply With Quote
Old 08-07-2007, 11:29 AM   PM User | #7
effpeetee
Senior Coder

 
effpeetee's Avatar
 
Join Date: Feb 2007
Location: Clapham Junction - London SW
Posts: 4,884
Thanks: 228
Thanked 204 Times in 203 Posts
effpeetee is an unknown quantity at this point
We don't want to Russia, but if you Moscow.................
__________________
* Sources (updated: 21.11.2012.
Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.
effpeetee is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:22 PM.


Advertisement
Log in to turn off these ads.