Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing one frame when user clicks in another

Status
Not open for further replies.

philcha

Programmer
May 10, 2000
109
GB
I have a frameset:<br>&lt;frameset rows=&quot;200,*&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frameset cols=&quot;220,*&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frame name=&quot;A&quot; src=&quot;A.htm&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frame name=&quot;B&quot; src=&quot;B.htm&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/frameset&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frame name=&quot;C&quot;&gt;&nbsp;&nbsp;&lt;!-- Initially empty --&gt;<br>&lt;/frameset&gt;<br><br>so the page layout is <br><FONT FACE=monospace>+-------+<br>¦ A ¦ B ¦<br>+-------+<br>¦&nbsp;&nbsp;&nbsp;C&nbsp;&nbsp;&nbsp;¦<br>+-------+</font><br><br>I want to change the URL of frame C when the user clicks something in frame A.<br><br>It's easy in IE:<br>parent.C.document.location.href = newURL;<br>in frame A's onClick event handler.<br><br>But everything I've tried in Netscape gives an error when the Javascript code in frame A tries to run, e.g. &quot;parent.C has no properties&quot;.<br><br>And all the examples I've seen e.g. in Netscape's Client Side Reference and Guide assume a higher-level frame in the frameset hierarchy is driving a sibling or lower-level one&nbsp;&nbsp;-&nbsp;&nbsp;I want a lower-level frame to drive a higher one becaue it's the only way I can get the page layout I want (frame C is by far the widest).<br><br>Does anyone know how?
 
Got the solution&nbsp;&nbsp;-&nbsp;&nbsp;see my tip &quot;Creating empty frames&quot;.
 
try it like this:<br>&lt;frameset rows=&quot;200,*&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frameset cols=&quot;220,*&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frame name=&quot;A&quot; src=&quot;A.htm&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frame name=&quot;B&quot; src=&quot;B.htm&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/frameset&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frame name=&quot;C&quot; src=&quot;about:blank&quot;&gt;&nbsp;&nbsp;&lt;!-- Initially empty --&gt;<br>&lt;/frameset&gt;<br><br>Then, in A.htm:<br>&lt;a href=&quot;javascript:top.C.document.location.href='b.htm'&quot;&gt;Click to change href&lt;/a&gt; <br> <p>nick bulka<br><a href=mailto: > </a><br><a href= </a><br>Get your technical books at Bulka's Books<br>
 
the about:blank will give an error in netscape. something about the url not found. What I've always done is created a dummy html page, and loaded it into the empty frame. ie:<br><br>&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&nbsp;&lt;/body&gt;&lt;/html&gt;<br><br>or if you really wanted to get simple:<br><br>&lt;html&gt;&lt;/html&gt;<br><br>which is what the about:blank page contains. (suprise!); <p>theEclipse<br><a href=mailto:eclipse_web@hotmail.com>eclipse_web@hotmail.com</a><br><a href=robacarp.webjump.com>robacarp.webjump.com</a><br>**-Trying to build a documentation of a Javascript DOM, crossbrowser, of course. E-mail me if you know of any little known events and/or methods, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top