www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Random String

Hybrid View

  1. #1
    Join Date
    Dec 2002
    Posts
    177

    resolved [RESOLVED] Random String

    I have this Random String script. How do I enter the string into a text field:

    Code:
    <%
      function ActivationString( )
    
        Randomize( )
    
        dim CharacterSetArray
        CharacterSetArray = Array( _
          Array( 5, "abcdefghijklmnopqrstuvwxyz" ), _
          Array( 3, "0123456789" ) _
        )
    
        dim i
        dim j
        dim Count
        dim Chars
        dim Index
        dim Temp
    
        for i = 0 to UBound( CharacterSetArray )
    
          Count = CharacterSetArray( i )( 0 )
          Chars = CharacterSetArray( i )( 1 )
    
          for j = 1 to Count
    
            Index = Int( Rnd( ) * Len( Chars ) ) + 1
            Temp = Temp & Mid( Chars, Index, 1 )
    
          next
    
        next
    
        dim TempCopy
    
        do until Len( Temp ) = 0
    
          Index = Int( Rnd( ) * Len( Temp ) ) + 1
          TempCopy = TempCopy & Mid( Temp, Index, 1 )
          Temp = Mid( Temp, 1, Index - 1 ) & Mid( Temp, Index + 1 )
    
        loop
    
        ActivationString = TempCopy
    
      end function
      Response.write ActivationString
    %>
    and my form:

    HTML Code:
    <form id="form1" name="form1" method="post" action="">
    <input name="randomstring" type="text" id="randomstring"/>
    <input type="submit" name="button" id="button" value="Submit" />
    </form>
    Thank you!

  2. #2
    Join Date
    Jan 2008
    Location
    Florida
    Posts
    1,227
    <input name="randomstring" type="text" id="randomstring" value="<&#37;=ActivationString%>"/>

  3. #3
    Join Date
    Dec 2002
    Posts
    177
    Thanks Russ...that works!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles