Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <div>
- Enter the length of character:
- <input type='text' id="num">
- <button onclick="stringGen()">submit</button>
- <p id="result"></p>
- </div>
- <script type="text/javascript" >
- function stringGen()
- {
- //Type your code here.
- var lenn=document.getElementById("num");
- var arr='abcdefghijklmnopqrstuvwxyz0123456789';
- var a='';
- for(let i=0;i<lenn;i++){
- var pos=Math.random()*(35-0);
- a=a+arr[pos];
- }
- document.getElementById("demo").innerHTML = a;
- // return a; //Enter your return statement
- }
- </SCRIPT>
- </body>
- </html>
Add Comment
Please, Sign In to add comment