S
Steve
Hi;
I'm using
- Firefxo 2.0.0.11
- Internet Explorer 7.0.5730.11
Windows XP Professional Service Pack 2
I'm noticing that IE and Firefox handle onblur events slightly
differently. In the HTML page below I have a text field and a submit
button. The top one has a function connected to the onblur event
when someone leaves the text field. The submit button has a funciton
connected to the onclick event.
In both browsers, both functions will fire when I move the mouse from
the text field to the button and press the button.
However, in IE processing will halt in the first function for onblur
and if I press cancel in the resulting prompt, processing will
stop. This is what I want.
In Firefox the prompt will come up to but processing will fall through
to the onlick function at the same time. I don't want this.
Why does this happen and how can I alter my code to work the same in
both browser, such that Firefox will do the onblur code and not fall
through to the onclick unless the prompt gets a positive response?
Thanks much in advance for any information
<html>
<head>
<title>Test onblur FF vs IE</title>
<script language = "JavaScript">
function procApple(typeApple)
{
if(typeApple != 'gala')
prompt("I only eat Gala Apples, please give me a gala");
var self=this;setTimeout(function(){self.focus();},1);
}
function validate()
{
alert("in validate function");
}
</script>
</head>
<body background = "white">
<form name = "form1">
Apple
<input type = "text" name = "apple" onblur = "procApple(this.value);">
<br>
<br>
<input type = "submit" name = "submitButton" value = "submit" onclick
= "validate();">
</form>
</body>
</html>
I'm using
- Firefxo 2.0.0.11
- Internet Explorer 7.0.5730.11
Windows XP Professional Service Pack 2
I'm noticing that IE and Firefox handle onblur events slightly
differently. In the HTML page below I have a text field and a submit
button. The top one has a function connected to the onblur event
when someone leaves the text field. The submit button has a funciton
connected to the onclick event.
In both browsers, both functions will fire when I move the mouse from
the text field to the button and press the button.
However, in IE processing will halt in the first function for onblur
and if I press cancel in the resulting prompt, processing will
stop. This is what I want.
In Firefox the prompt will come up to but processing will fall through
to the onlick function at the same time. I don't want this.
Why does this happen and how can I alter my code to work the same in
both browser, such that Firefox will do the onblur code and not fall
through to the onclick unless the prompt gets a positive response?
Thanks much in advance for any information
<html>
<head>
<title>Test onblur FF vs IE</title>
<script language = "JavaScript">
function procApple(typeApple)
{
if(typeApple != 'gala')
prompt("I only eat Gala Apples, please give me a gala");
var self=this;setTimeout(function(){self.focus();},1);
}
function validate()
{
alert("in validate function");
}
</script>
</head>
<body background = "white">
<form name = "form1">
Apple
<input type = "text" name = "apple" onblur = "procApple(this.value);">
<br>
<br>
<input type = "submit" name = "submitButton" value = "submit" onclick
= "validate();">
</form>
</body>
</html>