473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

simple JS works in IE but not firefox?

4
Hi All,

I have a form on a webpage witha submit button where the button is disabled until the user ticks a checkbox. It works perfectly in IE but not in firefox. My code is below:

<script type="text/javascript">
function disable_enable(){
if (document.all || document.getElementByid){
document.order.submit_button.disabled=!document.or der.submit_button.disabled
}
}
</script>

<input type="checkbox" name="C1" value="ON" onclick="js:disable_enable()">

<input type="submit" value="Submit" name="submit_button" disabled>


Any help or idea's very much appreciated :)
Jul 10 '06 #1
4 4473
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function disable_enable() {
  3.     if(C1.checked) {
  4.     submit_button.disabled = false;
  5.     } else {
  6.     submit_button.disabled = true;
  7.     }
  8. }
  9. </script>
  10.  
  11. <input type="checkbox" name="C1" id="C1" value="ON" onclick="js:disable_enable()">
  12.  
  13. <input type="submit" value="Submit" id="submit_button" id="submit_button" disabled> 
  14.  
this is how it could be done...
Jul 18 '06 #2
bja714
4
Thanks heaps :) couldnt have done it without you!
Jul 26 '06 #3
bja714
4
hmm... small problem.. now it works fine in forefox.. but without touching anything else IE now says "error on page" when i tick the checkbox.

Error on line 10, char 2, "C1 is undefined".

I have the script above in my header should it not be there?
Jul 26 '06 #4
iam_clint
1,208 Expert 1GB
you might try document.getElementById("C1").checked
Jul 26 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Tony LaPaso | last post by:
Hi All, I have a simple style sheet example below and I'm seeing different results in IE 6 vs. Firefox 1.0.3. I'm not sure which browser is rendering it correctly but I'm tending to think it's...
9
by: Astra | last post by:
Hi everybody Wonder if you could help me out. I created a simple JavaScript routine to enable a user to click backwards and forwards between small news articles. This routine works fine in IE...
14
by: David Blickstein | last post by:
I have some XML documents that I want to open in a web browser and be automatically translated to HTML via XSLT. I'm using an xml-stylesheet processing command in a file called "girml.xml". ...
4
by: puja | last post by:
hi all, I have an asp.net website where am including .css file dynamically on page load event. For diff users, there is diff CSS file. So after user logs in, I am setting CSS href on page load....
7
by: db | last post by:
Hi@all Just got a comparison problem with javascript. I want to compare : document.getElementById(currentID).getAttribute("style") with a string, e.g: "background-color: lightgreen;" They...
6
by: SuperFool | last post by:
This has got to be one of those questions only a serious newbie would come up with.... Basicly: I select all the city names in the table and turn them into a pull down menu (code below) print...
5
by: gray_slp | last post by:
I am designing a web survey using surveymonkey.com and discovered I could use javascript to modify their standard question formats much the same as can be done in myspace. I used this feature to...
3
by: fulio pen | last post by:
Hello, I have a code that works on both the IE and Opera, but not the Firefox, and I cannot figure out the reason. Following is the page: http://www.pinyinology.com/test/span2.html And...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.