Advertisement
mimmie

Untitled

Feb 2nd, 2021 (edited)
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  2.         "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6.     <title>Random names</title>
  7.     <meta name="description" content="A do it yourself name generator from online-generators.com" />
  8.    
  9.    
  10.    
  11.     <!-- The Generator script. You can move the script to an external file for better overview -->
  12.     <script type="text/javascript">
  13.     /*  Online Name Generators v.1.0 script is  made by Niels Gamborg webmaster at online-generator.com.  
  14.     *    The script is  free (as in "free speech" and also as in "free beer") in anyway. Use it after you own likings.
  15.     *    Peace and love. :)
  16.     */
  17.         function generator(){
  18.             // Add your own words to the wordlist. Be carefull to obey the showed syntax
  19.            
  20.             var wordlist1 = ["It's the heir :)", "It's not the heir :(", "Next one is heir :|"]
  21.            
  22.            
  23.             // Random numbers are made
  24.             var randomNumber1 = parseInt(Math.random() * wordlist1.length);
  25.             var name1 = wordlist1[randomNumber1];              
  26.            
  27.             //alert(name); //Remove first to slashes to alert the name
  28.            
  29.             //If there's already a name it is removed  
  30.             if(document.getElementById("result")){
  31.                 document.getElementById("placeholder").removeChild(document.getElementById("result"));
  32.             }
  33.               // A div element is created to show the generated name. The Name is added as a textnode. Textnode is added to the placeholder.
  34.             var element = document.createElement("div");
  35.             element.setAttribute("id", "result");
  36.             element.appendChild(document.createTextNode(name1));
  37.             document.getElementById("placeholder").appendChild(element);
  38.         }    
  39.     </script>
  40.    
  41.    
  42.    
  43.    
  44.    
  45.    
  46. </head>
  47. <body onload="generator()">
  48.     <div id="wrapper">
  49.        
  50.         <!-- Change the text to your needs -->
  51.         <p>If the heir is already chosen, ignore this</p>
  52.        
  53.         <!-- The generator result and button. Change text on the button by changing button value. Be carefull changing ID's in this part -->
  54.         <div id="generator" >
  55.             <div id="placeholder"></div>
  56.         </div>
  57.        
  58.         <!--  Change the text to your needs -->
  59.         <p></p>
  60.        
  61.         <!-- The footer. Place any contact info ect here.-->
  62.         </p>
  63.         </div>
  64.     </div>
  65. </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement