Hi Guys,
im having some issues with javascript and IE8, i have a form which has a small javascript checkbox so that users must check that they have read terms and conditions before they can submit the form, if the box is not checked a little msg pops up asking them to check this box
it works fine in firefox but nothing happens when i try in IE, it seems to have disabled the submit button all together
here is my code
Javascript:
html:Code:<script type="text/javascript"> window.onload=function(){ document.forms[0].onsubmit=function(){ return checkIt(); } } function checkIt() { if(document.getElementById('tos').checked==false) { alert('you need to check the "I accept terms of service" box'); document.getElementById('tos').className='highlight' return false; } else { document.getElementById('tos').className=''; return true; } } </script>
does anyone know where i am going wrong?Code:<form method="post" action="#"> <input id="tos" type="checkbox"><label for="tos"> I accept terms of service</label> </form>
thanks



Reply With Quote

Bookmarks