tag:blogger.com,1999:blog-2720325367592426200.post1560947821791033917..comments2024-03-17T22:01:43.204-07:00Comments on Useful and interesting web sites: Dynamically change image in jsMarkhttp://www.blogger.com/profile/16964923116965247316noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-2720325367592426200.post-16093305682748489692009-05-20T10:57:03.879-07:002009-05-20T10:57:03.879-07:00Here is code, click on first button and two images...Here is code, click on first button and two images will be changed. Click on second button and old two images will appear. Hope this code help you.<br /><br /><br /><html><br /><head><br /><br /><script type="text/javascript"> <br />function newImages() <br />{ <br /> document.getElementById("image1").src="http://www.userinterfaceicons.com/80x80/undo.png"; <br /> document.getElementById("image2").src="http://www.userinterfaceicons.com/80x80/forward.png";<br />} <br /> <br />function oldImages()<br />{<br /> document.getElementById("image1").src="http://www.userinterfaceicons.com/80x80/redo.png"; <br /> document.getElementById("image2").src="http://www.userinterfaceicons.com/80x80/backward.png";<br />} <br /> <br /></script><br /><br /><br /><body> <br /><br /><img id="image1" src="http://www.userinterfaceicons.com/80x80/redo.png" alt="Example of change src atribute of image with javascript"><br /><img id="image2" src="http://www.userinterfaceicons.com/80x80/backward.png" alt="Example of change src atribute of image with javascript"><br /><button id="butChangeImg" onclick="newImages()">New images</button> <br /><button id="butChangeImg" onclick="oldImages()">Old images</button> <br /></body><br /></html>Markhttps://www.blogger.com/profile/16964923116965247316noreply@blogger.comtag:blogger.com,1999:blog-2720325367592426200.post-18493528619394252462009-05-18T13:05:00.000-07:002009-05-18T13:05:00.000-07:00I will answer you for few days.I will answer you for few days.Markhttps://www.blogger.com/profile/16964923116965247316noreply@blogger.comtag:blogger.com,1999:blog-2720325367592426200.post-85752116695606140642009-05-16T16:46:00.000-07:002009-05-16T16:46:00.000-07:00Nice code. Thanks for the tip. The only thing I wo...Nice code. Thanks for the tip. The only thing I would love to know is what the code would look like for several images/buttons. Would you be able to give me a hand?<br />Thanks,<br />AndyAnonymousnoreply@blogger.com