Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 9th, 2003, 04:53 AM
Registered User
 
Join Date: Oct 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default onchange() cancelling onclick()!

Hello!

I want to control the user's while he navigates but I encountered the follwoing problem: the onchange() function seems to cancel the onclick()!

In the following (simplified), using IE 6, when ones click on the button after having changed the text, the onchange() function is called, but not the onclick()!!!!

<HTML>
 <HEAD>
    <SCRIPT>
      function fCh() { alert ("Changed"); }
      function fPE() { alert ("Click"); }
    </SCRIPT>
 </HEAD>
 <BODY>
   <FORM>
    <INPUT class="text" type="text" value="BONJOUR" onchange="fCh();">
    <INPUT type="button" onclick="fPE();">
   </FORM>
  </BODY>
</HTML>

Thank for your help.

Eric

 
Old October 9th, 2003, 05:13 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I think it's just that you alert box grabs the focus before you have clicked on the button.

--

Joe
 
Old October 9th, 2003, 06:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

there is no problem on ur sample!!!

Always:),
Hovik Melkomian.
 
Old October 9th, 2003, 08:03 AM
Registered User
 
Join Date: Oct 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You were right Joe : the example was too simplified and the alerts did modify the behaviour (Heisenberg incertitude principle ;).

The problem was that the code processing the onchange was hidding the button... In this case, the click event seems to disappear. I solved the problem by delaying the call to the function hidding the button by a setTimeout().

Thank you.

Eric






Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Option's onclick,onchange events issue manishk73 Javascript 7 August 29th, 2008 01:20 PM
cancelling close form rashi Access 2 October 12th, 2007 08:49 AM
Can I use onchange in combobox Hylsan Beginning PHP 2 December 18th, 2006 08:20 AM
Cancelling a record entry dlamarche Access 8 March 10th, 2005 11:53 PM
'onChange' crmpicco Javascript How-To 2 January 28th, 2005 05:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.