MozillaZine

Javascript bug on onblur event

Discussion of bugs in Mozilla Firefox
girishsk
 
Posts: 2
Joined: November 4th, 2004, 1:44 am
Location: Banglore

Post Posted November 4th, 2004, 2:50 am

The javascript onblur does not work properly.Javascript written for on blur event and the next event that caused onblur are executing simultaneously.....It is not supposed to happen.It seems there is problem in handling events....

example code:

<html>
<body>

<script language="javascript">
function test(){
alert("ok");
}
</script>
<input type="text" name="test" onblur=javascript:test()>

<a href="http://www.girishsk.co.nr">Test</a>
</body>
</html>

onblur event and a href event occur simultaneously .....It is not supposed to happen

fyo

User avatar
 
Posts: 530
Joined: February 17th, 2004, 5:09 pm

Post Posted November 4th, 2004, 6:17 am

Why not?

When you click the link after having focused on the input, you are removing focus from the inout - i.e. blurring it, so the event should trigger.

I don't know what spec would cover this type of thing, but it *seems* reasonable to be.

-fyo
--------------------
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/2007022001 Firefox/2.0.0.2

girishsk
 
Posts: 2
Joined: November 4th, 2004, 1:44 am
Location: Banglore

Post Posted November 4th, 2004, 10:16 pm

Not actually
when you click on the href the event onblur has to occur first and it has to wait till the onblur event function is handled .......... I will give an example
Suppose if i am checking for the value in the text box on onblur and if submitting the form has resulted in the onblur event, submitting the form is done... without giving user an option to change what he/she has entered.

fyo

User avatar
 
Posts: 530
Joined: February 17th, 2004, 5:09 pm

Post Posted November 5th, 2004, 7:32 am

I see your point about using it for such functionality (but why not use onChange or some such?), but there has to be a specification on this... so the real question is what does the spec say?

In IE, when I type something in the form field and then click the link, the a href NEVER fires. But I just clicked the link! That's counterintuitive to me.

Sounds like you are trying to accomplish something using a very inappropriate method. Depending on your exact needs, it would seem that onchange, onsubmit etc. would be better suited.

-fyo
--------------------
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/2007022001 Firefox/2.0.0.2

imranbagwan.cs
 
Posts: 3
Joined: January 3rd, 2018, 4:17 am

Post Posted January 3rd, 2018, 4:20 am

I am facing similar issues, and there is difference between onblur and onchange.

So i have to use onblur.

the issue is with Mozilla ESR version, and not With regular Mozilla.

LIMPET235
Moderator

User avatar
 
Posts: 38477
Joined: October 19th, 2007, 1:53 am
Location: The South Coast of N.S.W. Oz.

Post Posted January 3rd, 2018, 5:38 am

Hi,
Please....check the date before posting.
This thread died on Sat 6th Nov 2004 01:32:20 am.

Locking due to very old age.
Ancient Amateur Astronomer
Win-7-HP/IntelĀ® DualCore-2.0GHz/500G HDD/4 Gig Ram/550Watt PSU/350WattUPS/Firefox-20.0-57.0-61.0-62.0/T-bird-2.0.0.24/SnagIt-v10.0.1/MWP-7.11.0.
RadioYachting. (Always choose the "Custom" Install.)

Return to Firefox Bugs


Who is online

Users browsing this forum: No registered users and 1 guest