Search
 
SCRIPT & CODE EXAMPLE
 

HTML

random code generator

let randomCode = (Math.random() + 1).toString(36).substring(7);
console.log("random code :", randomCode);
Comment

Simple random code generator

<html>  
<head>   
<title> Random String Generator </title>  
</head>  
  
<script>  
function randomStringGenerator() {  
    var characters = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";  
              
            //specify the length random new string  
    var lenString = 8;  
    var randomstring = '';  
  
    for (var i=0; i<lenString; i++) {  
        var rnum = Math.floor(Math.random() * characters.length);  
        randomstring += characters.substring(rnum, rnum+1);  
    }  
  
    document.getElementById("randomfield").innerHTML = randomstring;  
}  
</script>  
  
<body>  
<center>  
<h2 style="color: red"> Random String Generator </h2>  
<h3> Click the button to generate a new random string </h3>  
  
<form name="randomstring">  
<input type="button" value="Generate " onClick="randomStringGenerator();">  
<br><br>  
<b><p id="randomfield" style="color: blueviolet"> </p></b>  
</form>  
  
</center>  
</body>  
</html>
Comment

PREVIOUS NEXT
Code Example
Html :: mysql data to html table 
Html :: text field input default value html 
Html :: highlight a text in html 
Html :: html form razor 
Html :: font html 
Html :: html cheat sheet 
Html :: js input just audio files 
Html :: bootstrap hide navbar 
Html :: simplecss cdn 
Html :: iframe 
Html :: underline text html 
Html :: input type="date" 
Html :: what is the meta tag in html 
Html :: Cambiar el texto de label usando JavaScript 
Html :: include jquery if not included 
Html :: MQ is not defined, 
Html :: nativescript router navigate 
Html :: nice error page html 
Html :: vertical tabs bootstrap 
Html :: how to make text move in html 
Html :: excel auto tage with date and time 
Html :: Hide overflow for Absolute images 
Html :: nav-pills class bootstrap 
Html :: Basic progressbar with percentage values 
Html :: how link back to home page html without index 
Html :: carousel with javascript 
Html :: how to add href of messaGing IN ANCHOR TAG 
Html :: input groups 
Html :: what is radio button in html used for 
Html :: boots form 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =