PDA

View Full Version : accept terms js still not complete



emanuelle
02-21-2009, 05:04 PM
http://www.dynamicdrive.com/dynamici...acceptterm.htm

I need to have 2 images for the submit button
one disable and one enable

I have found this script on DD
<script>
function toggle() {
var state = !arguments[arguments.length-1];
for(var i=1; i<arguments.length-1; i++) {
document.forms[arguments[0]][arguments[i]].disabled = state;
}
}



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[i]
if(tempobj.type.toLowerCase()=="submit"){
tempobj.disabled=!checkobj.checked
tempobj.className=(tempobj.disabled==true)?'style1_alt':'style1';}
}
}
}
function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}</script>

.style1{background:#eee;}
.style1_alt{background:#fc0;}

<form name="agreeform" onSubmit="return defaultagree(this)">
Rest of your form here<br>
<input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>I agree to the above terms</b><br>
<input type="Submit" value="Submit!" disabled>
</form>

<script>
//change two names below to your form's names
document.forms.agreeform.agreecheck.checked=false
</script>

BUT SOMEHOW IT DOES NOT RECOGNIZE THE ENABLE STYLE(style1).
it is really important that the disable and enable have 2 differsnt styles.
so can someone help me?????