VB icon

Random Picture Generator

Email
Submitted on: 1/5/2015 10:43:00 AM
By: Yu Chang (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: ASP (Active Server Pages), HTML
Views: 1095
 
     This code simply generate a random picture and display. It also teaches beginners about random numbers.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Random Picture Generator
' Description:This code simply generate a random picture and display. It also teaches beginners about random numbers.
' By: Yu Chang (from psc cd)
'
' Inputs:Create some pictures and name them as "pic1.jpg, "pic2.jpg", and so on. Enter the LowerBound and UpperBound of the picture number.
'
' Returns:Displays a random picture.
'
' Side Effects:The picture names are static.
'**************************************

<HTML>
<HEAD>
<TITLE>Random Generated Picture</TITLE>
</HEAD>
<BODY>
<!--Copy starting from here-->
<CENTER>
<%
	Randomize
	Dim RandomNum, UpperBound, LowerBound
	LowerBound = 1 'Put in the first picture #
	UpperBound = 10 'Put in the last picture #
	RandomNum = Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)
%>
<IMG SRC="pic<% = RandomNum %>.jpg">
</CENTER>
<!--Copy end here-->
</BODY>
</HTML>


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.