|
I'm really TRYING to learn the most basic stuff in Javascript, but seem to spend hours and hours on each tiny thing. This is so minor, you'll laugh at me. This is just a box that has to be checked before next page will open. I've tried this with checkbox value 0 / 1 and true / false. Makes no difference.
Here's my script. What the $&@% is wrong with it? Nothing happens. I can't write the simplest!
My thanks in advance to anyone who can take a second to help! Mykstor, Los Angeles.
<scr r ipt language=javascript>
<!--
function validate(chk)
if (chk.checked !== 1);
{
alert("You haven't checked the AGREEMENT box. Please READ the AGREEMENT, then check the box.");
}
else
{
document.open('stories1.html');
}
-->
</scr r ipt>
---------------
my call:
<form>
<input type=checkbox name=chk><font color="#FF0000"> CHECK HERE Â </font>
<p><input type=button value="check" onClick="return validate(chk);"></p>
</form>
|
|
|
<sc rr ipt language="javascript">
function validate(){
if (x.chk.checked){
alert("allright");
}else{
alert("You haven't checked the AGREEMENT box. Please READ the AGREEMENT, then check the box.");
}
}
</sc rr ipt>
---------------
<form name="x" onSubmit="validate();">
<INPUT TYPE="checkbox" name="chk" ><font color="#FF0000"> CHECK HERE </font>
<p><INPUT TYPE="submit" value="check" ></p>
</form>
So a function starts with a"{" and ends with "}", a form must have a name.
<Added>
see below
|
|
|
script language="javascript"
function validate(){
if (x.chk.checked){
alert("allright");
}else{
alert("You haven't checked the AGREEMENT box. Please READ the AGREEMENT, then check the box.");
}
}
/script
---------------
form name="x"onSubmit="validate();"
INPUT TYPE="checkbox" name="chk"
INPUT TYPE="submit" value="check"
/form
a function starts with "{", end with "}", form has a name
|
|
|
Thank you so much!!!
Mike
|
|
|
Beautiful blog with great informational content. Mostly certifications related and headache related topics are really very good. 1z0-051 dumps, NS0-163 dumps and 646-985 dumps are also good topics. Thanks for this great sharing.
|
|
|