html and javascript problem,please help TQ?

ctjacfan

New member
having stuck with this... and cannot run very well.... somebody please help me TQ

<HTML>

<HEAD>

<TITLE>
Question B : HTML and Javascript Example
</TITLE>

<script type="text/javascript">
function validate(formCheck) //Function with a parameter representing a form name.
{
if (formCheck.name.value == "")
{
alert("Please provide your name:");
formCheck.name.focus();
return false;
}
var mail = formCheck.email.value
if (mail.indexOf("@.") == -1)
{
alert("Invalid Email");
formCheck.email.focus();
return false;

}

return true;
}
</script>


</HEAD>


<BODY>

<FORM name="inform" action="" method="post" onClick="return validate(inform)";>
Your Name: <INPUT type=text NAME="name" value="" SIZE=30><br>
Your Email: <INPUT type=text NAME="email" value="" SIZE=30>
<INPUT type="button" name="submit" value="Validate" >

</FORM>

</BODY>

</HTML>





<HTML>

<HEAD>



<script type="text/javascript">

function tick()

{
var select = document.forms[0].selection;
var txt = "";
var num=0;

for (i=0; i < select.length; ++i)

{
if (select.checked)

{
++num;

txt = txt + num;
txt = txt + ".";
txt = txt + "";
txt = txt + select.value;
txt = txt + ", ";
}
}

window.alert("You are interested in : " + txt);
}

</script>

</HEAD>


<BODY>

How can we help you ?

<BR>


<FORM>

<INPUT TYPE=CHECKBOX NAME="selection" VALUE="Program offered" > I'm interested in your program offered

<BR>

<INPUT TYPE=CHECKBOX NAME="selection" VALUE="Short courses" > I'm interested in short courses

<BR>

<INPUT TYPE=CHECKBOX NAME="selection" VALUE="Visiting our campus" > I'm interested in visiting your campus

<BR><BR>

<BUTTON TYPE="BUTTON" VALUE="Process" onClick="tick()"> Process </BUTTON>

</FORM>

</BODY>


</HTML>
 
Back
Top