Jump to content

frame navigation using javaScript


ssffcc

Recommended Posts

hi, I have a top-bottomLeft-bottomRight frameset and three pages (details01.html, details02.html and details03.html):

<frameset rows="80,*" cols="*" frameborder="no" border="0" framespacing="0">  <frame src="topFrame.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />  <frameset cols="80,*" frameborder="no" border="5" framespacing="0">    <frame src="leftFrame.html" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />    <frame src="mainFrame.html" name="mainFrame" id="mainFrame" title="mainFrame" />  </frameset>  </frameset>

on leftFrame.html, I want to have navigation links to the three pages. when the link of "details01.html" is clicked, the mainFrame.html will display the details01.html, when the link of "details02.html" is clicked, the mainFrae.html will display the details02.html.is it possible to do this with javaScript? plz help, I am new to javaScript

Link to comment
Share on other sites

I wrote this in HTML:

<h5>details 01 </h5><br /><a href="javascript:setPage()">details01</a>

and this in java script:

<script type="text/javascript"> function setPage() {   parent.leftFrame.document.src="lab1_Details.html"; } </script>

nothing is happening, plz help

Link to comment
Share on other sites

another relevant question: I have these lines of code to generate a page with 6 horizontal frames:

<frameset cols="20%,15%, 25%, 15%, 10%, 15%">  <frame src="frame_a.htm">  <frame src="frame_b.htm">  <frame src="frame_c.htm">  <frame src="frame_d.htm">  <frame src="frame_e.htm">  <frame src="frame_f.htm"></frameset><noframes></noframes>

is it possible to have JavaScript to generate the HTML and display the pages side by side in a frameset (getting the same result of the above code)?

Link to comment
Share on other sites

for javascript to generate html, put it all in a document.write()

<script>document.write('<frameset cols="20%,15%, 25%, 15%, 10%, 15%">');document.write('<frame src="frame_a.htm">');document.write('<frame src="frame_b.htm">');document.write('<frame src="frame_c.htm">');document.write('<frame src="frame_d.htm">');document.write('<frame src="frame_e.htm">');document.write('<frame src="frame_f.htm">');</script>

Let me know if it's not what you needed :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...