ASP ScriptingJava ScriptingCGI ScriptingHTMLJavaLanguage CERP Education Links

JAVA SCRIPTING

Working With Radio Buttons, CheckBox, Push Buttons, Text Field

  Radio Button - Check Box - Push Button - Text Field

     Radio Button is an element which allow the user to select one and only one option given in list of choices.

     Check Box is a component that can be used to make multiple choices from the list of choices.

     Buttons are used to play an action on the form. With the help of the buttons information can be submit that is accepted by the user for further processing or is also used to reset the contents in the form.

     The Text Field is a component used to accept the information from the user.

<HTML>
<HEAD>
<TITLE>Use Of Button & Text Field</TITLE>
<SCRIPT LANGUAGE=JAVASCRIPT>
function Check()
{
var sex="";
if(document.form1.Gender[0].checked && document.form1.Gender[1].checked)
{
sex += "Oh No  !! I can't got you !! ";
}
else
{
if(document.form1.Gender[0].checked)
{
sex+="Your Gender is Male";
}
else
{
sex+="Your Gender is Female";
}
}
alert(sex);
}
function TxtButton()
{
var username="";
username=document.form1.f_name.value;
ans= "Your Name :" + username + "\n\n";
 alert(ans)
}
function rdbt()
{

var gendr="";
if(document.form1.Gender[0].checked)
gendr += "Your Gender is Male";
else(document.form1.Gender[1].checked)
gendr +="Your Gender is Female";
alert(gendr);
}
</SCRIPT>
</HEAD>
<BODY >
<H1><CENTER>Push Buttons  and Text Fields and Gender</H1></CENTER>
<FORM NAME="form1">
<B>Name : </B><INPUT TYPE="TEXT" NAME = "f_name" SIZE = "20" MAXLENGTH = "20">
<INPUT TYPE="CHECKBOX" NAME="Gender" VALUE="Male" CHECKED>Male<BR>
<INPUT TYPE="CHECKBOX" NAME="Gender" VALUE="Female" CHECKED>Female<BR>
<INPUT TYPE="RADIO" NAME="Gender" VALUE="Male" CHECKED>Male<BR>
<INPUT TYPE="RADIO" NAME="Gender" VALUE="Female" CHECKED>Female<BR>
<BR>
<BR>
<CENTER>
<INPUT TYPE="BUTTON"VALUE="Check Name"ONCLICK="TxtButton()">
<INPUT TYPE="BUTTON"VALUE="Gender With CheckBox"ONCLICK="Check()">
<INPUT TYPE="BUTTON"VALUE="Gender With RadioButton"ONCLICK="RdBt()">
<INPUT TYPE="RESET" VALUE="Reset Form">
</CENTER>
</FORM>
</BODY>
</HTML>

 


Your Ad Here
Not All Of Your Subscribers Use RSS - AWeber Email Marketing
Your Ad Here