javascript - OnMouseOver / OnMouseOut -
i'm using onmouseover , onmouseout function change colour of social media icons in footer of wordpress website: http://www.retelevise.com.
it works fine, i'm using snippet of javascript link email address (i read somewhere way hide address spammers?) – javascript doesn’t seem mouse function.
<script type="text/javascript"> <!-- var addr1 = "mailto:" var addr2 = "info" var addr3 = "@" var addr4 = "retelevise" var addr5 = ".com" document.write('<a href="' + addr1 + addr2 + addr3 + addr4 + addr5 + '">') document.write('<img src="http://www.retelevise.com/wp-content/themes/myownzee/branding/socialmedia-email-1.png" onmouseover="this.src='http://www.retelevise.com/wp-content/themes/myownzee/branding/socialmedia-email-2.png'" onmouseout="this.src='http://www.retelevise.com/wp-content/themes/myownzee/branding/socialmedia-email-1.png'" class="social-icons-main" title="email" alt="email"></a>'); //--> </script>
if remove mouse function, grey email icon appears without switching colour version on hover, when try adding mouse code, email icon disappears altogether. did @ similar answers posted here, sorry didn't understand them. have ideas please?
thanks, sn.
there no escaping of single quotes used within single quoted value.
http://jsbin.com/nakoduqa/1/edit
var addr1 = "mailto:" var addr2 = "info" var addr3 = "@" var addr4 = "retelevise" var addr5 = ".com" document.write('<a href="' + addr1 + addr2 + addr3 + addr4 + addr5 + '">') document.write('<img src="http://www.retelevise.com/wp-content/themes/myownzee/branding/socialmedia-email-1.png" onmouseover="this.src=\'http://www.retelevise.com/wp-content/themes/myownzee/branding/socialmedia-email-2.png\'" onmouseout="this.src=\'http://www.retelevise.com/wp-content/themes/myownzee/branding/socialmedia-email-1.png\'" class="social-icons-main" title="email" alt="email"></a>');
Comments
Post a Comment