tags:

views:

121

answers:

2

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 files 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

+7  A: 

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.

ephemient
Thanks for your reply. I will check with your solution.
vijay
I tried your solution is worked to remove # after url, but still unfortunately when I click on the video link it says connection and then opening media but nothink plays on the windows media player. Can you advice. Thank
vijay
That's a different problem, for which you have given not enough information to diagnose. (In fact, there was barely enough there to make this inferred answer.) Please provide more details, including source code.
ephemient
Hi,I have the code for you as follows:-first of all in the head tag I have following javascript:-<head><script type="text/javascript">{function startmeup(urlname)player.url=urlname}</script>then I load windows media player<object id="player" type="video/x-ms-wmv" classid="CLSID:6bf52a52-and the rest" class="style" style="width:273px;height:255px"></object>and then in the main body I have individual links for the videos to play<span><a href="#" onclick="startmeup(file='my url name/afghan.avi;);return false"></a></span>I hope it helps now ThanksVijay
vijay
Hi,Just checking with you, any suggestions on the code
vijay
Code is not very readable in comments; you would have been better off editing the question to add the new information. At a quick glance, though: `startmeup(file=...)` is silly, JS doesn't support named parameters; and I think you should be changing `.data` or `.src` or something like that, not `.url`. But I'm not really sure since I don't run Windows.
ephemient
+1  A: 

in addition to ephemient, you can use:

<a href="javascript:void(0);" onclick="function();">...</a>
Malfist
tHANKS FOR YOUR REPLY.
vijay