|
Forme tjeter programimi per aplikacionet web, jo aq e
perpahur sa php. Ky eshte nje shembull i nje scripti ne
ASP:
<%
' Determines how many unique random letters to be produced
tot_unique=8
dim random_number, counter, check, unique_letters
' When passing a varible for an array use redim
redim random_letter(tot_unique)
' begin random function
randomize
' Begin a for next loop from one to the max number of
unique letters
For counter = 1 to tot_unique
' select a number between 26 and 97
random_number = Int(26 * Rnd + 97)
' take the numeric and turn it into a character
random_letter(counter) = Chr(random_number)
' write out the current choice to the browser
response.write random_letter(counter)
' For next loop to compare the values stored in the array
to
' the new random value being assigned
for check=1 to counter-1
if random_letter(check)= random_letter(counter) then
' If the current value is equal to a previous value
' subject
counter=counter-1
end if
next ' Repeat loop to check values
next ' Repeat loop to assign values to the array
%>
<p>
<ol><% 'write out the unique letters in a list for display
For counter = 1 to tot_unique
response.write "<li>" & random_letter(counter) & "</li>"
' accumulate the array values to one varible
unique_letters=unique_letters & random_letter(counter)
next 'repeat loop for display/variable creation
%></ol>
Unique Random Letters:<br>
<%= unique_letters %>
<p>
Click <a href="<%= request.servervariables("script_name")
%>">here</a> to refresh this page
</body>
|