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!

Frameset definition & source in same .html page?

Status
Not open for further replies.

clayj

Technical User
Aug 8, 2002
6
0
0
US
I have been challenged to generate a page with two column frames and contain the frame source within a single html page. I have the pages working in the normal fashion where my index.html page defines the framesets for 'left' and 'right', and the src= definition points to their resective left.html and right.html files. I wasn't able to figure out how to define the frame sources (src=) such that they point to code within index.html. Thought I might be able to use 'anchor', but apparently not. Does anyone have any suggestions? Thx.
 
clayj,

I'm not sure about a static solution, but it might be possible using Javascript. Here's a possible solution (the theory sounds fine, but I haven't tested it...):

Create the frameset, and point the frame src of each frame to be
Code:
"about:blank"
. Then add an onLoad event to the frameset, so when it's all done, you can run some code:

For each of the frames you want to 'load' the source for, you could do something like:

Code:
frameName.document.open();
frameName.document.writeln('<html>');
frameName.document.writeln('<head>');
frameName.document.writeln('</head>');
frameName.document.writeln('<body>');
frameName.document.writeln('Line 1<br>');
frameName.document.writeln('Line 2<br>');
frameName.document.writeln('Line 3<br>');
frameName.document.writeln('</body>');
frameName.document.writeln('</html>');
frameName.document.close();[code]

As I say - the theory sounds fine, so it's over to you to see if it works in practice ;o)

Hope this helps!

Dan
 
Thanks BillyRay... boy, a reason (or opportunity) to learn a little javascript. ;)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top