Replace image with JS and DOM

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. <!-- script rollover de imagens -->
  2. <script>
  3. var imgPath = '';
  4. function switchImg(img, src) {img.src = imgPath + src;}
  5. </script>
  7. <img src="<gazzag:i18nDir />/addfriend.gif" alt="<gazzag:i18n key="addfriend" />" onmouseover="switchImg(this, '<gazzag:i18nDir />/addfriend_hover.gif');" onmouseout="switchImg(this, '<gazzag:i18nDir />/addfriend.gif');" />

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.