OnClick/OnChange not working in IE

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Feb 2008
Posts: 198
Reputation: dinilkarun is an unknown quantity at this point 
Solved Threads: 0
dinilkarun dinilkarun is offline Offline
Junior Poster

OnClick/OnChange not working in IE

 
0
  #1
Nov 28th, 2008
Hi,

I have a checkbox on click of which I'm calling a JavaScript function to disable another checkbox. The onClick event is not working in both Firefox/IE. I am capturing onChange event of the checkbox1 as of now which works in Firefox, but not working in IE.
Please suggest a way to implement this. This is urgent.

Thanx.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,652
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 474
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: OnClick/OnChange not working in IE

 
0
  #2
Nov 29th, 2008
*Not working* is not a very helpful description of the problem. You should try debugging your script and inspecting variables to see if they are causing a problem. Use the Microsoft Script Debugger if using IE and Firebug if using Firefox.

Also, onclick works:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title>Title</title>
  5. <META http-equiv="Content-Type" content="text/html; charset=utf8">
  6. <script type="text/javascript">
  7. function doDisable(elem, id) {
  8. var e = document.getElementById(id);
  9. if(!e || !elem) return;
  10. e.disabled = elem.checked;
  11. }
  12. </script>
  13. </head>
  14. <body id="bdy">
  15. <form name="frm" id="frm" action="#">
  16. <div id="container">
  17. <input type="checkbox" id="chk1" name="chk1">
  18. <br><br>
  19. <input type="checkbox" id="chk2" name="chk2" onclick="doDisable(this, 'chk1');">
  20. </div>
  21. </form>
  22. </body>
  23. </html>
I don't accept change; I don't deserve to live.

Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 2924 | Replies: 1
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC