Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Randomize in VBSCRIPT

Status
Not open for further replies.

dropper

Technical User
Mar 5, 2002
2
ZA
I need to do something in VBSCRIPT, I am very new with it so any help would be great.

1.) button on web page
2.) when pressed it randomizes a number between 1 and 10
3.) does an if then else for under 5 and over 5
4.) if under 5 display a picture or over 5 displays a different picture
5.) adds 1 to a feild each time over 5 substracts 5 each time under 5
6.) displays a message that says "under or over 5" (you get the picture)

A demo of this is probably pretty simple, but appreciated

PLEASE HELP! Thanks
 
1-4:


randomize timer/rnd

function GiveNumber(nHigh)
GiveNumber=int(nHigh * rnd + 1)
end function

dim nValue
nValue = GiveNumber(10)

Response.Write &quot;<form method=post action=example.asp>&quot;
Response.Write &quot;Random nummber: &quot; & nValue & &quot;<br>&quot;
if nValue < 5 then
Response.Write &quot;<img src=pic1.jpg>&quot;
else
Response.Write &quot;<img src=pic2.jpg>&quot;
end if
Response.Write &quot;<br><input type=submit value=Demo!></form>&quot;
br
Gerard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top