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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you send a URL as a variable to a frame?

Status
Not open for further replies.

JerryH

Programmer
Jul 8, 2000
15
0
0
US
I'm trying to send a url to a 2nd frame of a new frameset. The url is in the form of a variable called &quot;menu.&quot; Eventually I will get the value of &quot;menu&quot; from another script but for testing I'm just setting the value to &quot;history.html.&quot; Below is the script I'm trying to get to work. What's wrong with it?<br><br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&lt;SCRIPT Language=&quot;JavaScript&quot;&gt;<br>&lt;!--<br>//menu = location.search.substring(1)<br>menu = &quot;history.html&quot;<br>--&gt;<br>&lt;/SCRIPT&gt;<br>&lt;/HEAD&gt;<br><br>&lt;frameset rows=&quot;65,*&quot;&gt;<br>&lt;frame name=&quot;nav&quot; SRC=&quot;menu.htm&quot; target=&quot;body&quot;&gt;<br>&lt;frame name=&quot;body&quot; SRC=&quot;javascript:parent.menu&quot;&gt;<br>&lt;/frameset&gt;<br><br>&lt;/HTML&gt;<br>
 
Dear Jerry,<br><br>Here is one way.<br><br>&lt;html&gt;<br>&lt;HEAD&gt;<br>&lt;SCRIPT LANGUAGE=javascript&gt;<br>&lt;!--<br>menu = &quot;history.htm&quot;;<br>document.write(&quot;&lt;frameset rows='65,*'&gt;&quot;);<br>document.write(&quot;&lt;frame name='nav' src='menu.htm'&gt;&quot;);<br>document.write(&quot;&lt;frame name='body' src='&quot; + menu +&quot;'&gt;&quot;);<br>document.write(&quot;&lt;/frameset&gt;&quot;);<br>//--&gt;<br>&lt;/SCRIPT&gt;<br>&lt;/html&gt;<br><br><br>Good luck<br>-pete
 
Jerry, <br><br>Quick comment about your original Script.&nbsp;&nbsp;The &quot;--&gt;&quot; should be &quot;//--&gt;&quot;.&nbsp;&nbsp;<br><br>The way you have it will cause an error in Netscape but not Internet Explorer.<br><br>This is an error that I see made on many sites and I just had to make you aware of it.<br> <p>Ray<br><a href=mailto: > </a><br><a href= Mall for Webmasters</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top