I have windows media player on my main page with video links. So when I click the link that particular video should play in the media player inside my web page. I am using javascript to handle this. My video fi开发者_如何学编程les are also stored on the remote server. But when I click on the video link the address box shows a # sign after the url which does not load the video file. My javascript is ok as it runs perfectly well no my local computer. If anyone has a solution for me would be really appreciated.
Thanks Vijay Zutshi
I'm guessing you're using something like this?
<a href="#" onclick="do_something(1)">...</a>
If so, the simplest solution would be along these lines:
<a href="#" onclick="do_something(1); return false">...</a>
This instructs the browser not to perform the normal click action (which navigates to the #
anchor) after your onclick
handler has run.
in addition to ephemient, you can use:
<a href="javascript:void(0);" onclick="function();">...</a>
精彩评论