Sunday 14 June 2015

HTML Form and VB Script

<script language="vbscript">
sub abc
x=document.fr.t1.value
if document.fr.ra(0).checked then
a=5000
elseif document.fr.ra(1).checked then
a=7000
end if
b="0"
if document.fr.ca(0).checked then
b=b+500
end if
if document.fr.ca(1).checked then
b=b+350
end if
if document.fr.ca(2).checked then
b=b+200
end if
z=a+b
q=document.fr.li.selectedindex
if q=0 then
z=z-100
elseif q=1 then
z=z-50
end if
document.fr.t2.value=ucase(x)&" you have to pay Rs."&z
end sub
</script>
<form name="fr">
<h1 align="center">Modern School,Antarctica</h1>
Enter name<input type="text" name="t1"><br>
Day Boarding<input type="radio" name="ra">
Hostel<input type="radio" name="ra"><br>
Cantine<input type="checkbox" name="ca">
Sports<input type="checkbox" name="ca">
Library<input type="checkbox" name="ca"><br>
Payment Option<select name="li">
<option>Credit Card
<option>Cash
</select><br>
<input type="button" value="Bill" onClick="abc">
<input type="text" name="t2" size="100">
</form>

Instructions :-
  1. Copy this code and paste it in notepad
  2. Save it with an extension .html
  3. Run it on Internet Explorer only.It might not work on other browser as they do not support vb language.

No comments:

Post a Comment