I have the following code which works fine until I try and display graphics.
Please tell me how I could/should display the odometer in graphics format rather than text.
I have all the necessary images as .png(0 through 9) in the same folder as the following code. It is just that the text counter displays but not the graphics?
Code:<html> <head> <script type="text/javascript"> var c=0; var t; var timer_is_on=0; function GraphicOdo(Nommer) { d = Nommer.toString(); for (i=0; i<d.length; i++) { var image="<IMG SRC=c"+d[i]+".gif>"; // alert(image); document.getElementById('GraphicCounter').innerHtml=image; } } function timedCount() { document.getElementById('txt').value=c; c=c+1; GraphicOdo(c); t=setTimeout("timedCount()",1000); } function doTimer() { if (!timer_is_on) { timer_is_on=1; timedCount(); } } </script> </head> <body> <form> <input type="button" value="Start count!" onclick="doTimer()"> <input type="text" id="txt" /><br /><br /> <div id="GraphicCounter"> <img src="c0.gif" alt="zero"/> </div> </form> </body> </html>




Reply With Quote