| 1. |
Create a form that contains two textbox options and radio button with two options as shown belowWhen the user clicks on any of radio buttons, the message should be displayed according to selected gender.For Example if the First name entered by user is Neeraj and Last Name entered by user is Singh the following message should be displayed according to the selected GenderGenderMessageMaleHello Mr.N.Singh. Welcome to our website.FemaleThank You Ms N.Singh for visiting the website.Write the HTML code for creating the form and the embedded VBScript code for the click events of the button. |
|
Answer» <html > <head> <title>Form Processing</title> <SCRIPT LANGUAGE="VBScript"> <!-- Sub calc_OnClick Dim TheForm Set TheForm = Document.form1 If TheForm.gender(0).checked Then MsgBox "Hello Mr. "& left(Theform.fname.value,1) &". "& Theform.lname.value & ". Welcome to our website." Elseif TheForm.gender(1).checked Then MsgBox "Thank You Ms. "& left(Theform.fname.value,1) &". "& Theform.lname.value & " for visiting the website." End If End Sub --> </SCRIPT> </head> <body> <form action="" name="form1"> <p>First Name <input name="fname" type="text" > <br > <br > Last Name <input name="lname" type="text" > <br > <br > Gender<br > <input name="gender" type="radio" value="male" > Male<br > <input name="gender" type="radio" value="female" > Female</p> <p> <label> <input type="button" name="calc" value="Show Me" > </label> <br > </p> </form> </body> </html> |
|