Click the hyperlink to invoke the JavaScript function, which is commonly used by people:
Copy Code code as follows:
<a href= "javascript:function ();" >
But there is a drawback, that is, click on the link, the GIF animation on the page will still.
Look at the following code:
Copy Code code as follows:
<script type= "Text/javascript" >
<!--
function Foo ()
{
Do something
}
-->
</script>
<a href= "Javascript:foo ();" > Keep GIF Animated links </a>
Solution approach:
Copy Code code as follows:
<a onclick= "Javascript:foo ();" > Links </a>
At this time does not affect the animation display, but after the mouse moved up, the mouse and hyperlink style does not change, although you can use the style sheet to change the mouse and hyperlink style, but after all, some cumbersome, and this kind of thinking is not good.
The following code is further examined:
Copy Code code as follows:
<a onclick= "Javascript:foo ();" href= "#" > Links </a>
We can find that although clicking on the link does not affect the animation, but the page is always rolling to the top, this effect is not what we want.
Final Solution:
Copy Code code as follows:
<a onclick= "Javascript:foo (); return false;" href= "#" > does not affect GIF links </a>
If you don't consider the problem with GIF pictures, the above methods are available.