Advertisement
Fakher_AldeenOdeh

javascript Example 2

Oct 21st, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.82 KB | None | 0 0
  1. <html>
  2. <head>
  3.  <title>by Fakher_Aldeen Odeh</title>
  4.  <script type="text/javascript">
  5.  
  6.  
  7. window.onload = function(){
  8.  
  9.  
  10. var g;
  11. g = document.getElementById('selectimg');
  12.  
  13. g.onclick = function(){
  14.  
  15.  
  16. var i;
  17. i = document.getElementById('selectimg').selectedIndex;
  18.  
  19. document.getElementById('divshow').innerHTML = "<img src="+document.getElementsByTagName('option')[i].value+".png>";
  20.  
  21.  
  22.  
  23.  
  24.  
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. }
  35.  
  36.  </script>
  37.  
  38. </head>
  39.  
  40. <body>
  41.  
  42. please select your image :
  43.  
  44. <select id="selectimg">
  45. <option selected>select image</option>
  46.     <option value="die1">die1</option>
  47.     <option value="die2">die2</option>
  48.     <option value="die3">die3</option>
  49.     <option value="die4">die4</option>
  50.     <option value="die5">die5</option>
  51.     <option value="die6">die6</option>
  52. </select>
  53.  
  54.   <div id="divshow"></div>
  55.  
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement