Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Get Iframe Location

    Ok what I'm trying to do is have a snipet of code check the location of an iframe.

    If the Iframe is at audioplayer.html I want it to do nothing.
    Otherwise I want it to change to audioplayer.html

    Code:
    if(parent.audioframe.location.href == "http://www.newlifegallup.org/video/audioplayer.html","http://newlifegallup.org/video/audioplayer.html") { null }
    else { parent.audioframe.location.href = "audioplayer.html"; }
    I'm do realize "null" also probably isn't the right thing.


    You can see a link of what I'm trying to do here.
    http://newlifegallup.org/video/template.html

    I want it so that when you open the audio or video player you can click close to completely close it, I have this setup by hiding the layer and changing the iframe to a blank page. I have it set up so if the audio player is open and i click the video player it will close the audio and change the audio iframe to blank. But when you go back to click the audio button i need it to check the iframe's location. Because I don't want it to just change the iframe location every time.

    I hope this is understandable

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Give this a try

    Code:
    if(parent.audioframe.location.href.indexOf("audioplayer.html") == -1){
    parent.audioframe.location.href = "audioplayer.html"
    }
    Last edited by Mr J; 05-04-2007 at 01:43 PM. Reason: Corrected typo
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmmm... now the windows/layers are not even popping up.

    Here is the exactly what I have


    Code:
    <script type="text/javascript" language="JavaScript"><!--
    function FrameCheckA() {
    if(parent.audioframe.location.href.indexOf("audioplayer.html") == -1{
    parent.audioframe.location.href = "audioplayer.html"
    }
    //--></script>
    I know its real ugly but the other stuff is to show the layer that has the iframe, and a couple other things.

    Code:
    <table width=100px height=19px cellspacing=0 border=0 cellpadding=0><tr><td align=center bgcolor="" OnClick="parent.videoframe.location.href = 'blank.html'; FrameCheckA(); ShowContent('audioplayer'); HideContent('videoplayer'); return true;" OnMouseOver="changeto(event,'a6bf6d')" OnMouseOut="changeback(event,'')" style="cursor: pointer;">
    	<font face=arial size=-2 color=ffffff>AUDIO PLAYER</font>
    </td></tr></table>

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You missed the ) and }
    Code:
    function FrameCheckA() {
      if(parent.audioframe.location.href.indexOf("audioplayer.html") == -1) {
         parent.audioframe.location.href = "audioplayer.html"
      }
    }
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Awesome it works!

    Much appreciated guys!

    That thing was driving me crazy all day.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •