badge Posted April 26, 2006 Share Posted April 26, 2006 I'm having a bizarre problem, written a javascript to change a value in a textbox dependent on the value of a selected radio button. I have an onClick on each of the buttons which runs a function which starts thus: function allcheck() { if (document.getElementById('capture1').checked) { document.getElementById('capture').value = 450 } if (document.getElementById('capture2').checked) { document.getElementById('capture').value = 730 and continues in a similar fashion.this works fine in Firefox amd Safari, but doesn't do anything whatsoever when it runs on Internet Explorer. I have a similar script in the page which starts function couplingcheck() { if (document.getElementById('couplingcheckbox').checked) { document.getElementById('couplingtotal').value = 200, document.getElementById('stops1').disabled = false, which works in IE. I'm using GoLive which generates some script of its own and am really quite confused. Any ideas?Thanks in advance, badge Link to comment Share on other sites More sharing options...
Little Goat Posted April 26, 2006 Share Posted April 26, 2006 well, can you give the code containing your textboxes?LGEdit: the only difference is you use commas on the second snippet. Link to comment Share on other sites More sharing options...
badge Posted April 28, 2006 Author Share Posted April 28, 2006 sorry Little Goat, been away for a few days,the check box and text box refered to in the working code appear here: <td>Check for coupling: <input type="checkbox" id="couplingcheckbox" onclick="couplingcheck()"></td><td colspan="2"><div align="right">Total:<input type="text" name="e" id="couplingtotal" size="6" value="0"/></div></td> and the part which doesn't work has radio buttons: <td>Number of stops:</td><td align="right">1 - 32</td><td width="24"><input type="radio" Id="stops1" name="stops" disabled="true" onclick="allcheck()"></td><td colspan="3" align="right">Stops Total: <input type="text" name="b" id="stops" size="6" value="0"/></td> As I said, everything works fine in Firefox, Opera and Safari, but checking the radio boxes in IE gives no response,ta, badge Link to comment Share on other sites More sharing options...
Kosher Kid Posted April 28, 2006 Share Posted April 28, 2006 you are missing closing brackets. function allcheck() { if (document.getElementById('capture1').checked) { document.getElementById('capture').value = 450 } if (document.getElementById('capture2').checked) { document.getElementById('capture').value = 730 }}function couplingcheck() { if (document.getElementById('couplingcheckbox').checked) { document.getElementById('couplingtotal').value = 200 document.getElementById('stops1').disabled = false }} and i'm not sure why you put the commas after the last statements. i don't believe they are necessary and ie objected to having a comma after the last statement.also, i'm not sure what you are looking for with only one radio button. but whatever value i entered in the stops total box, i got 200 in the total box when i checked the "check for coupling" box.what are you looking for? Link to comment Share on other sites More sharing options...
Little Goat Posted April 28, 2006 Share Posted April 28, 2006 maybe the radio doesnt come up as checked like the checkboxes do.I'm not sure... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now