onload event event javascript not responding -


javascript code:

<script type="text/javascript">   function react() {      document.getelementbyid("img").src = second.jpg   } </script> 

html page:

<div style="width:170px;height:160px;border:2px solid blue">  <img src="first.jpg" style="width:inherit;height:inherit" id="img" onload="settimeout('react()', 15000)"/> </div> 

please the image in not change meant change first.jpg second.jpg in 15000 milliseconds set settimeout() function

second.jpg means "the jpg property of second object" (which hasn't been mentioned before throw reference error).

you need use string literal: "second.jpg".


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -