...

View Full Version : Accept Terms script, doesnt work on Firefox...help please!



tcollick
12-10-2004, 08:11 AM
Hi everyone,

I have used the script below for our website:

<SCRIPT language=JavaScript>
<!--

//Accept terms & conditions script (by InsightEye www.insighteye.com)
//Visit JavaScript Kit (http://javascriptkit.com) for this script & more.

function checkCheckBox(f){
if (f.agree.checked == false )
{
alert('Please check the box to continue.');
return false;
}else
return true;
}
//-->
</SCRIPT>

<form action="/test.html" method="GET" onsubmit="return checkCheckBox(this)">

I accept: <input type="checkbox" value="0" name="agree">
<input type="submit" value="Submit form">
</form>

It is based on this script: http://www.javascriptkit.com/script/script2/accept_term.shtml.

Both scripts work fine on IE but can't I get them to work on Firefox. On IE the script takes the user to designated page as long as the checkbox is ticked. But on Firexfox it does nothing!

Any ideas would be appreciated !

thanks,

Tony

rmedek
12-10-2004, 08:29 AM
I'm no javascript guru, but I tested the code you posted and it worked just fine (FF 1.0 on OS X). Perhaps you should post the rest of your code (in code tags) in case there is something else relevant to your problem...

Brandoe85
12-10-2004, 08:42 AM
take out the red slash...<form action="/test.html" method="GET" onsubmit="return checkCheckBox(this)">
nevermind...i was thinking of something else...

Kor
12-10-2004, 09:10 AM
Try:

if (!f.agree.checked)

tcollick
12-10-2004, 10:14 AM
Thanks guys!,

Brandoe85...removing the slash worked...i feel a bit stupid!

regards,

Tony



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum