P
Paul Oakfleet
The script below will disable Submit button until user accept terms,
and will redirect user to another page after clicking on Submit
button.
The script seems to work fine on my PC (Windows XP, IE6), however I
don't know if it's written well. I would like the opinion of someone
who knows how to write these codes properly. Please let me know if
there're any logic errors.
PS: Please keep in mind that I didn't write this script, I found it
over the internet. Therefore do not make me responsible for (1)
copyright, (2) any damage this script may cause, (3) incompatibility,
(4) bugs this script may have.
Here's my entire page:
<html>
<head>
<script>
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){ //hunt down submit button
var tempobj=checkobj.form.elements
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}
function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please Read/Accept our Terms of Service/Agreement to
continue.")
return false
}
}
}
</script>
<SCRIPT LANGUAGE="JavaScript">
var destination="redirectingpage.htm";
function redirect()
{
window.location = destination;
}
// End -->
</script>
</head>
<body>
<form method="post" name=agreeform onSubmit="return
defaultagree(this)" action="javascript:redirect()">
<iframe name="agreement" src="email/agreement.htm" border="0"
frameborder="0" marginwidth="3" marginheight="3" width="600"
height="110" style="border: 3px solid #294A63">
Your browser does not support inline frames or is currently configured
not to display inline frames.</iframe></p>
<input name="agreecheck" value="agree" type="checkbox"
onClick="agreesubmit(this)">I Agree to the above Terms of
Service/Agreement<br>
<input type="Submit" value="Continue" disabled></form>
<script>
document.forms.agreeform.agreecheck.checked=false
</script>
</body>
</html>
and will redirect user to another page after clicking on Submit
button.
The script seems to work fine on my PC (Windows XP, IE6), however I
don't know if it's written well. I would like the opinion of someone
who knows how to write these codes properly. Please let me know if
there're any logic errors.
PS: Please keep in mind that I didn't write this script, I found it
over the internet. Therefore do not make me responsible for (1)
copyright, (2) any damage this script may cause, (3) incompatibility,
(4) bugs this script may have.
Here's my entire page:
<html>
<head>
<script>
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){ //hunt down submit button
var tempobj=checkobj.form.elements
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}
function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please Read/Accept our Terms of Service/Agreement to
continue.")
return false
}
}
}
</script>
<SCRIPT LANGUAGE="JavaScript">
var destination="redirectingpage.htm";
function redirect()
{
window.location = destination;
}
// End -->
</script>
</head>
<body>
<form method="post" name=agreeform onSubmit="return
defaultagree(this)" action="javascript:redirect()">
<iframe name="agreement" src="email/agreement.htm" border="0"
frameborder="0" marginwidth="3" marginheight="3" width="600"
height="110" style="border: 3px solid #294A63">
Your browser does not support inline frames or is currently configured
not to display inline frames.</iframe></p>
<input name="agreecheck" value="agree" type="checkbox"
onClick="agreesubmit(this)">I Agree to the above Terms of
Service/Agreement<br>
<input type="Submit" value="Continue" disabled></form>
<script>
document.forms.agreeform.agreecheck.checked=false
</script>
</body>
</html>