Reply
Auto focus form
Old 12-07-2006, 12:14 AM Auto focus form
Skilled Talker

Posts: 63
I found some auto focus on input field using javascript but when I try using Firefox, the script dowsn't work like on IE.

Can any body tell me the auto focus script that compatible with IE, Firefox, and Opera
jaketmerah is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 12-07-2006, 10:44 AM Re: Auto focus form
logic ali's Avatar
Skilled Talker

Posts: 88
Quote:
Originally Posted by jaketmerah View Post
I found some auto focus on input field using javascript but when I try using Firefox, the script dowsn't work like on IE.

Can any body tell me the auto focus script that compatible with IE, Firefox, and Opera
How about displaying the script that you have, including the way that you're using it.
logic ali is offline
Reply With Quote
View Public Profile
 
Old 12-07-2006, 03:09 PM Re: Auto focus form
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
Converting Video For YouTube
Posts: 2,339
Name: Keith Marshall
Location: West Hartford, CT
I always use the onload attribute in the body tag:

<body onload="document.form_name.field_name.focus();">
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 12-08-2006, 10:59 AM Re: Auto focus form
foobar's Avatar
Extreme Talker

Posts: 225
Try changing it to:

Code:
<body onload="document.forms['form_name'].elements['element_name'].focus();">
However, Opera doesn't support onload. To bypass that, add an inline JavaScript block.

Code:
<script type="text/javascript">
   document.forms['form_name'].elements['element_name'].focus();
</script>
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
Old 12-11-2006, 11:47 PM Re: Auto focus form
Skilled Talker

Posts: 63
I just found this and it work on IE, Opera, and Firefox

Put on body onLoad

Quote:
<body onLoad="self.focus();document.form1.username.focus ()">
Then on your form

Quote:
<form action="" method="post" name="form1">
<input type="text" name="username" size="20">
</form>
jaketmerah is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Auto focus form
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12393 seconds with 12 queries