WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 event handling pronlem, prasad patil, April 14, 2004
     Re:event handling pronlem, Brian R. James, April 14, 2004

Subject: Re:event handling pronlem From: Brian R. James Date: April 14, 2004

Never use an alert() method to test event handling.  As you've seen, alert() fired on one event will cancel all over events in the event queue.  Replace your alerts, and you will see that both events are in fact firing as you'd expect.

<html>
<head>
<title>Events</title>
<script language="JavaScript">
 function f(){
  //alert("inside f");
 document.frm.a.value = "f changed";
 }
 function f2(){
  //alert("inside f2");
 document.frm.b.value = "button changed";
 }
</script>
</head>

<body>
<form name="frm">
 <input type="text" name="a" onchange="f()"/>
 <input type="button" name="b" value="click" onclick="f2()"/>
</form>
</body>
</html>

Brian R. James

From: prasad patil
Sent: April 14, 2004
Subject: Re:event handling pronlem

Hi all,

I am facing one problem regarding events. The problem is at the same time if there are two events that are getting fired, only one event handler gets called. I have sample code :

<html>
<head>
<title>Events</title>
<script language="JavaScript">
 function f(){
  alert("inside f");
 }
 function f2(){
  alert("inside f2");
 }
</script>
</head>

<body>
<form name="frm">
 <input type="text" name="a" onchange="f()"/>
 <input type="button" name="b" value="click" onclick="f2()"/>
</form>
</body>
</html>

In this code change the value in the textbox, and without tab-out from textbox click on button. But now only f is getting called though i am expecting f and f2 should be called in order. Can anybody throw light on this?

Thanks,

Prasad Patil.

Caritor(India) Pvt Ltd.

 





Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX