image - Need my fully working javascript rewritten in proper javascript -
can please help me simplifying - working script @ to the lowest degree wrote swap images?
here it:
<img id="swap_green_img" onmouseover="swapgreen()" onmouseout="swaporiggreen()" onclick="window.open('http://www.stackoverflow.com', '_blank')" style="position:relative; z-index:999; float:left; margin-right:10px; cursor:pointer; height:25px; width:30px" src="facebook_like_icon_orig_50x43.png" width="30" alt="" border="0" /> <img id="swap_red_img" onmouseover="swapred()" onmouseout="swaporigred()" onclick="window.open('http://www.stackoverflow.com', '_blank')" style="position:relative; z-index:999; float:left; margin-right:10px; cursor:pointer; height:25px; width:30px;" src="facebook_like_icon_orig_50x43.png" width="30" alt="" border="0" /> <script type="text/javascript"> function swapgreen() { document.getelementbyid("swap_green_img").src='facebook_like_icon_green_50x43.png'; } function swapred() { document.getelementbyid("swap_red_img").src='facebook_like_icon_red_50x43.png'; } function swaporigred() { document.getelementbyid("swap_red_img").src='facebook_like_icon_orig_50x43.png'; } function swaporiggreen() { document.getelementbyid("swap_green_img").src='facebook_like_icon_orig_50x43.png'; } </script>
thanks much in advance! torsten
function swap(color){ document.getelementbyid("swap_" + color + "_img").src='facebook_like_icon_' + color + '_50x43.png'; }
note: not fits code, should done way
javascript image swap
No comments:
Post a Comment