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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP and javascript

Status
Not open for further replies.

sheaffer

Programmer
Feb 23, 2003
4
AU
Okay i am trying to make a random number script using javascript but it wont work. I have used the same script without asp before and i wanted to know if microsofts version of javacript alows this sort of thing

var num=(now.getSeconds())3% // now is a Date()
 
I found this someplace, and modified it to make random passwords. Does this help?
~~~~~~~~~~~~~~~~~~~~~~~~~
<%

' Find range size - restrict to alpha-numerics
intRangeSizeNumber = 57 - 48
intRangeSizeUcase = 89 - 65

for J = 1 to 10
Randomize()

' Get a random number from 0 to the size of the range
RandomValueNumber = intRangeSizeNumber * Rnd()
RandomvalueUcase = intRangeSizeUcase * Rnd()

' Center the range of possible random numbers over the desired result set
RandomValueNumber = RandomValueNumber + 48
RandomValueUcase = RandomValueUcase + 65

' Convert our value to an integer
RandomIntNumber = chr(RandomValueNumber)
RandomIntUcase = chr(RandomValueUcase)

' The above 4 lines are equivilent to the popular shorter version
' below. I split it up so I could indicate what each step is doing.
' intRandomInteger = Int((intUpperBound - intLowerBound + 1) * Rnd + intLowerBound)

if 100 * Rnd < 50 then
password = password & RandomIntUCase
else
password = password & RandomIntNumber
end if
next

' Show out output indicating what we've done and our result.
Response.write &quot;password: &quot; & password
%>

norm ...
 
Yeah i think i can change that a little to make it work for me thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top