Search code examples
javascripthyperlinkonmouseoverframeset

How to use onmouseover to open link in another frame?


For a frameset, i want to open a link from page of A frame by using onmouseover and open it in another B frame? when mouseover the link from A frame, it will open the page on B frame. Give a hint.


Solution

  • When I worked with <frame> it has taking a long time ago (seven or more years).

    Because you didn't post any html sourcode :-|, I created a theoretical situation:

    <html>
        <head>
          <script type="text/javascript">
           function nullRand () {
             //document.getElementById("frameBid").src = "myNewInternalPage.html";
               document.getElementById("frameBid").src = document.getElementById("frameAid").src;
            }
          </script>
        </head>
        <frameset cols="25,*" frameborder="no" border="0" framespacing="0" framepadding="0">
           <frame id="frameAid" name="frameAname" src="myHtmlFile.html" noresize>
           <frame id="frameBid" name="frameBname" src="" noresize>
        </frameset>
    </html>
    

    SIn my theoretical file 'myNewInternalPage.html' you have to instert the method call

    <a href="#" onMouseOver="parent.nullRand()">An link</a>
    

    Note: frame is not approiate to show external content. That's why iframe exists.

    Update:

    After a hard fight with the OP I got something to my hands. Here is a solution:

    1st: Replace the old Javascript code from 'nullRand()' with the new one

    function nullRand (linkObject)
    {
      document.getElementById("frameBid").src = linkObject.href; // The new way to access to a frame
      //top.frames["center"]..src = linkObject.href; <-- The old way to access to a frame */
    }
    

    2nd: Modyfiy the a tag -where the radio streams are listed- as follow:

    <a href="the Url from your radiostream" ... onMouseOver="parent.nullRand(this)">...</a>
    

    So it should work. In my eyes you should think about a new concept for your task.