Javascript DOM Image Element show Random Picture

Description

Javascript DOM Image Element show Random Picture

View in separate window

<!-- Random image generation using Math.random. -->
<html>
   <head>
      <script type = "text/javascript">
         document.write ( "<img src = \"image" +                
            Math.floor( 1 + Math.random() * 7 ) + ".png\" />" );
      </script>
   </head>/*from w  w  w. j av  a2  s . c  o  m*/

   <body>
      <p>Click Refresh (or Reload) to run the script again</p>
   </body>
</html>



PreviousNext

Related