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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

blur submit buttons outside form tags?

Status
Not open for further replies.

safra

Technical User
Jan 24, 2001
319
NL
Hi,

I have a couple of form submit buttons on my page. They are not used to send a form so they are not nested inside form tags.

Apparantly always one of the buttons gets focused after the page loads (thick border around it) if they are not nested within form tags, well at least in IE5.5 which I use.

I tried 'onLoad="this.blur()"' inside the button tag but it didn't work.

How can I solve this?

Thanks,
Ron
 
OnLoad can be applied only to the body tag (to be more exact, it's an event handler of the Image and window objects, but it's not our case).

Try something like that:
<body onload=&quot;document.formName.buttonName1.blur();document.formName.buttonName2.blur()&quot;>

Also, place all your buttons inside <form> tags. It is required for normal script functioning in all browsers, no matter what they are or not used for.

good luck
 
Thanks,

I guess it is better then to put them in form tags, this problem does not occur then anyway.

Ron

 
I still don't get this completely with those buttons and focus on it?

put an example here:

When the page loads everything is fine now, none of the buttons gets focused. But when you click somewhere inside the table or one of the form elements, the left button always gets focused?

Clicking the right button or outside the table removes the focus on the left button.

Is it just me?? can anyone test it? is this a browser issue or can I do something to solve it?

Ron
 
Try adding
Code:
onFocus=&quot;blur();&quot;
to both of the buttons. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Hi Tracy,

I tried that too (look at the source code).

Apparantly the left button is not treated as getting focused but still it shows the annoying border each time the user clicks in the table or on one of the other form elements.

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top