Newbie Programming: HTML5 Display Image - button onclick= -


first time programmer here, writing simple program on html5. can't seem image display when button clicked. here code:

<p>     <center>     <button onclick="deadtest()">     <img src="begintest.gif"/></button></center></p>      <script language="javascript" type="text/javascript">         function deadtest()          {             <img style="border-width: 0px;" src="white.jpg" width="768" height="1280" />         }     </script> 

have looked through countless sites , forums can't seem work. have tried alert() function , working. think must code call on image.

first time programmer might idiotic. teach me, oh guru's...

learn basics first on how call javascript function , how change properties.

see sample demo. hope learn it.

http://jsfiddle.net/ngrym/1/

<script  type="text/javascript">     function buttonclick()      {         alert('button clicked');     }     function imageclick(){         alert('image clicked');     }     function changeimagesrc(){         var img = document.getelementbyid('myimage');          img.src = "http://www.ivankristianto.com/wp-content/uploads/2011/05/javascript.gif";     }      function changesize(){         var img = document.getelementbyid('myimage');          img.height = "80";         img.width = "40";         }      </script> <p>     <center>         <input type="button" onclick="changeimagesrc()" value="change image src"/>         <input type="button" onclick="buttonclick()" value="test button click"/>         <input type="button" onclick="changesize()" value="change size"/>         <img id="myimage" src="http://www.mmncs.com/wp-content/uploads/javascript_logo.gif" onclick="imageclick()"/>         </center> </p> 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -