Forum Moderators: open

Message Too Old, No Replies

Small FireFox problem with a javascript

javascript doesn't work with firefox

         

andy2005

11:18 am on Nov 22, 2005 (gmt 0)

10+ Year Member




Hi,

Im new to javascript and learning. Can any kind soul please help me fix this script to work with Firefox (its already working with IE).

Everytime I click on the submit button to submit a form I end up at the very same page again when browsing with FireFox

Thanks in advanced.

Andy

<script language="JavaScript">
function pay(){
with (document.getElementById('ezm')){
if(prod1.checked == true && extra.checked == true){
window.location.href = "page1.html";
}
else if(prod1.checked == true){
window.location.href = "page2.html";
}
else if(prod2.checked == true && extra.checked == true){
window.location.href = "page3.html";
}
else if(prod2.checked == true){
window.location.href = "page4.html";
}
else if(prod3.checked == true && extra.checked == true){
window.location.href = "page5.html";
}
else if(prod3.checked == true){
window.location.href = "page6.html";
}
//window.location.href="";
}
}
</script>

kaled

11:59 am on Nov 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A few points
1) Don't use if (value==true) use if (value)
2) Is ezm a form? If not you will have to use getElementById to locate prodx.
3) In FF, open the Tools¦Javascript Console for debugging.
4) That code is horribly repetitive. You might also consider using a <select> object instead of a load of radioboxes (I hope you're not using checkboxes for mutually exclusive options).

Kaled.