Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    cgf
    cgf is offline
    Junior Member
    Join Date
    Feb 2003
    Posts
    16
    Member #
    758
    Guys,

    Im trying to open all my windows in the main frame of my frame set... However I am using a java script to create a type of menu... The problem that I keep having is that I am unable to open any of the link from the menu in the main frame, they insist on opening in the frame where the menu is (i.e. location)....

    <script language="JavaScript">
    <!--}
    function movein(which,html){
    which.style.background='333399'
    description.innerHTML=html}
    function moveout(which){
    which.style.background='cc0000'
    description.innerHTML='&nbsp;'
    //-->
    </script>

    <table width="75%" border="0" cellspacing="2" cellpadding="0" dwcopytype="CopyTableCell" bordercolor="#FFFFFF">
    <tr>
    <td class="menu" bordercolor="black" id="choice1" style="background-color:cc0000; cursor:hand" onmouseover="movein(choice1,'The Latest Forcast')" onmouseout="moveout(choice1)" onclick="location.href='http://www.javafile.com'" width="28%"><font color="#FFFFFF" size="2">
    Weather Report</font></td>
    <td class="menu" bordercolor="black" id="choice3" style="background-color:cc0000; cursor:hand" onmouseover="movein(choice3,'Directions to the Game')" onmouseout="moveout(choice3)" onclick="location.href='http://www.bravenet.com'" width="28%"><font color="#FFFFFF" size="2">Travel
    Details </font></td>
    </tr>
    <td class="menu" bordercolor="black" id="choice4" style="background-color:cc0000; cursor:hand" onmouseover="movein(choice4,'Meet our Sponsors')" onmouseout="moveout(choice4)" onclick=location.href='http://www.westendrugby.co.uk'" width="28%" bgcolor="cc0000" target="mainFrame"><font color="#FFFFFF" size="2">Club
    Sponsers</font></td>
    </tr></table>

    Any advice guys
    Thanks!!!!
    Happy go lucky!!!

  2.  

  3. #2
    cgf
    cgf is offline
    Junior Member
    Join Date
    Feb 2003
    Posts
    16
    Member #
    758
    Please ignore this post and check out the post in Javascript and Other Languages "Source Code"...
    Thanks Guys
    Happy go lucky!!!

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Ok, now I've seen your source. The problem is that you're using the ONCLICK event of the Table Data element to load the page. That said, you have to do the following to get it to work:

    in your frameset page, do something like this:

    <html>
    <head>
    &nbsp;&nbsp;<script language="javascript">
    &nbsp;&nbsp;function loadPage(url) {
    &nbsp;&nbsp;&nbsp;&nbsp;document.getElementById("m ainFrame").src = url;
    &nbsp;&nbsp;}
    &nbsp;&nbsp;</script>
    </head>
    <frameset rows="80,*">
    &nbsp;&nbsp;<frame id="navFrame" src="nav.htm">
    &nbsp;&nbsp;<frame id="mainFrame" src="main.htm">
    </frameset>
    </html>


    Then, in your navigation, try something like this:

    <html>
    <head>
    &nbsp;&nbsp;<script language="javascript">
    &nbsp;&nbsp;function loadPage(url) {
    &nbsp;&nbsp;&nbsp;&nbsp;if (window.parent != window) parent.loadPage(url);
    &nbsp;&nbsp;}
    &nbsp;&nbsp;</script>
    <body>
    &nbsp;&nbsp;<table>
    &nbsp;&nbsp;&nbsp;&nbsp;<tr>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td onclick="loadPage('new.htm')">Link</td>
    &nbsp;&nbsp;&nbsp;&nbsp;</tr>
    &nbsp;&nbsp;</table>
    </body>
    </html>


    That's that I don't see why the target=x isn't working, though. I can't see your source code, so I dunno.

  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    The document.getElementById(id).src property is necessary for Netscape compatibility. element.location.href won't work

    Just in case anyone's still interested in that kind of stuff


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:26 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com