Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Pages: [1]
Send this topic | Print
Topic: javascript refresh your lucky number  (Read 178 times)
« on: May 06, 2008, 02:33:54 PM »
metrazaman Offline
Newbie

View Profile
*
Posts: 4



<html>
  <head>
    <title>Lucky Numbers</title>
    <script language="JavaScript">

/* This function picks a random number between 0 and 9 and writes it to the page. */

      function doLucky() {
        var x = Math.round(Math.random() * 9);
        document.write(x);
      }

    </script>
  </head>
  <body>

<!-- The following paragraph calls the doLucky() function three times to write three
 random numbers to the page. -->

    <p>Here are your lucky numbers for the day: <strong>
       <script language="JavaScript">doLucky();</script>
       <script language="JavaScript">doLucky();</script>
       <script language="JavaScript">doLucky();</script>
       </strong></p>
  </body>
</html>

Report to moderator   Logged

 
 
Pages: [1]
Send this topic | Print
Jump to:  

Powered by SMF | SMF © 2006-2008, Simple Machines LLC