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

onblur event in span element doesn't fire in IE 6

Status
Not open for further replies.

nomadsolo

Programmer
Dec 28, 2006
11
0
0
IL
Here is sample code just to make the point. The onblur event doesn't fire in ie 6, but does fire in firefox. I require the onblur event in the span element as I have a web custom control. Please advise on how to capture onblur for span. I need the onblur for mouse activity as well as for tab movement - hence must have onblur. Thank you for any responses.

<html>
<head>
<script type="text/javascript"></script>
</head>
<body>
<form><span onblur="alert('kjkjk')"><select size=4 ><option>lklklk</option></select></span>
<span><input type=text><select size=4 ><option>lklklk</option></select></span>
</form>
</body>
</html>
 
As far as I know, only elements that can recieve focus can fire events such as onblur and onfocus. Given that the span element cannot recieve focus, I think you need to rethink your expectations.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
msdn documentation specifies that span element can implement onblur - and, in fact, firefox implements it successfully as I noted in my post. The reason I require the onblur event in the span element is because of the nature of the asp custom control I am using (too long and boring to go into.) Thank you for the response, in any event.

 
msdn documentation specifies that span element can implement onblur

MSDN also specifies that "onbur" is part of the HTMl 4 specs, and those specs say it can only be used with the following elements:

A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON.

This just re-iterates what I've told you. Work out how to change your control instead.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
The answer to my question is to use onfocusout event (or ondeactivate). This works in ie. There is no need to change the design of the control (especially considering all asp web custom controls are designed in this way). Thank you for the effort.
 
you are right. Using the onfocusout did not work as expected. It fired, all right, but it also fired from movement within the span child elements. I am at my wits end. Can anyone think of a way to capture this event and check to see if the movement is from within the span children or not?
 
explain what you're trying to accomplish, and we'll be glad to help. also, post your actual code rather than sample code, so we can avoid the "oh i forgot to mention" situations.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Only use onfocus on elements that you actually can focus. As told before, use the onfocus on the form elements instead - of curse..

- Lowet

[gray]Why can't all browsers parse pages the same way? It should be the Web designer who decides how to display the content, not the browser![/gray]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top