How to put that link into a function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • darkfact
    New Member
    • Sep 2010
    • 15

    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:
    Code:
    <a href="music/playlist.m3u" onclick="parent.document.getElementById('iframe1' 
    ).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:
    Code:
    function Play(){
    var file = location.href.substring(location.href.lastIndexOf('/')+1);
    var fileName =file.split('.',1);
    var getplaylist = [fileName] +  "/" + 'playlist.m3u'; 
    '[getplaylist] onclick="parent.document.getElementById("iframe1").contentWindow.PlayM3u(this.href);return false"';
    alert(getplaylist);
    }
    And then in my image map:
    Code:
    <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
  • darkfact
    New Member
    • Sep 2010
    • 15

    #2
    I figured it out.

    Comment

    Working...