View Single Post
  #2 (permalink)  
Old Oct 30th, 2007, 10:44
Rakuli's Avatar
Rakuli Rakuli is offline
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: do it 2 times???

When you place return false in a function it does not stop execution of queued up events.. It only stops execution of that function... In this regard, IE is actually doing the wrong thing - it should display both alerts...

You could try setting if you wanted to be a certain amount of time between alerts, you could try something like this... It will only display an alert if the last one was more than 1 second ago

HTML: Select all
<script type="text/javascript">

function blurEvent()
{
test();
return false
}

function clickEvent()
{
test()
return false;
}

var waitForMe = false; // this will tell us if there was an alert recently
function test()
{
    if (!waitForMe){
    alert("you are wrong");
    waitForMe = true; // set this to true so the alert won't run again until waitForMe is false
    }
setTimeout('waitForMe=false', 1000); // set back to false after one second.
}

</script>
Reply With Quote