469,307 Members | 2,570 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,307 developers. It's quick & easy.

How to put that link into a function?

Logic Ali answered my previous question about how to send a link from one iframe to another:
Expand|Select|Wrap|Line Numbers
  1. <a href="music/playlist.m3u" onclick="parent.document.getElementById('iframe1' 
  2. ).contentWindow.PlayM3u(this.href);return false">test</a>
Now I would like to put it into a function. This is what I've come up with:
Expand|Select|Wrap|Line Numbers
  1. function Play(){
  2. var file = location.href.substring(location.href.lastIndexOf('/')+1);
  3. var fileName =file.split('.',1);
  4. var getplaylist = [fileName] +  "/" + 'playlist.m3u'; 
  5. '[getplaylist] onclick="parent.document.getElementById("iframe1").contentWindow.PlayM3u(this.href);return false"';
  6. alert(getplaylist);
  7. }
And then in my image map:
Expand|Select|Wrap|Line Numbers
  1. <area shape="rect" coords="0,0,268,268" href="javascript:Play()">
It doesn't work. I tried putting the whole thing in the getplaylist var and the alert returned the entire thing correctly. But it didn't start the media player. So I moved it around the way it is now. It still doesn't work. Any ideas as to what I'm doing wrong?

Thanks
Sep 19 '10 #1
1 1239
I figured it out.
Sep 20 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Hagge | last post: by
3 posts views Thread by Samir | last post: by
5 posts views Thread by elsenraat_76 | last post: by
2 posts views Thread by laredotornado | last post: by
7 posts views Thread by Kurda Yon | last post: by
2 posts views Thread by syringa | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.