By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,970 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,970 IT Pros & Developers. It's quick & easy.

Dynamically add frames to frameset

P: n/a
Yun
I have a frameset initially loaded to a page
<frameset id=SV name=SV></frameset>

Now I want to use JavaScript to dynamically add frames to this
frameset. I have tried to use code like "document.frames.SV.innerHTML
= framedefinition"
Nothing worked.

How do I achieve this goal with JavaScript?

Thanks.
Nov 7 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Yun <yu******@gmail.comwrote in news:9d02177b-868a-4484-819d-a2d49f2d2370
@d42g2000prb.googlegroups.com:
I have a frameset initially loaded to a page
<frameset id=SV name=SV></frameset>

Now I want to use JavaScript to dynamically add frames to this
frameset. I have tried to use code like "document.frames.SV.innerHTML
= framedefinition"
Nothing worked.

How do I achieve this goal with JavaScript?

Thanks.
http://www.quirksmode.org/js/frameintro.html
Nov 7 '08 #2

P: n/a
Yun
Your answer is NOT an answer to my question. It merely explained how
to access frames and their elements from JavaScrpt.
What I am looking for is to CREATE new frames in a empty frameset with
JavaScript functions.

On Nov 7, 2:43*pm, Good Man <he...@letsgo.comwrote:
Yun <yun.w...@gmail.comwrote in news:9d02177b-868a-4484-819d-a2d49f2d2370
@d42g2000prb.googlegroups.com:
I have a frameset initially loaded to a page
<frameset id=SV name=SV></frameset>
Now I want to use JavaScript to dynamically add frames to this
frameset. *I have tried to use code like "document.frames.SV.innerHTML
= framedefinition"
Nothing worked.
How do I achieve this goal with JavaScript?
Thanks.

http://www.quirksmode.org/js/frameintro.html
Nov 7 '08 #3

P: n/a
Yun <yu******@gmail.comwrote in
news:7b**********************************@d36g2000 prf.googlegroups.com:
Your answer is NOT an answer to my question. It merely explained how
to access frames and their elements from JavaScrpt.
What I am looking for is to CREATE new frames in a empty frameset with
JavaScript functions.
learn about the DOM. innerHTML is not the way to go.

you'll need to brush up on JS anyways, just trying random stuff like
"document.frames.SV" isn't going to get you anywhere. of course, if you
DID read that link, you'd know how to properly access your frame named SV.
Nov 7 '08 #4

P: n/a
Yun
It sounds like you are really good with DOM and frames. I have tried
to use createElement and then append. It works for DOM element in one
page and across frames. But it doesn't work for FRAME or FRAMESET
itself.
Would you like to provide a sample code to dynamically append new
frame to an existing frameset?
On Nov 7, 2:56*pm, Good Man <he...@letsgo.comwrote:
Yun <yun.w...@gmail.comwrote innews:7b**********************************@d36g20 00prf.googlegroups.com:
Your answer is NOT an answer to my question. It merely explained how
to access frames and their elements from JavaScrpt.
What I am looking for is to CREATE new frames in a empty frameset with
JavaScript functions.

learn about the DOM. *innerHTML is not the way to go.

you'll need to brush up on JS anyways, just trying random stuff like
"document.frames.SV" isn't going to get you anywhere. *of course, if you
DID read that link, you'd know how to properly access your frame named SV..
Nov 7 '08 #5

P: n/a
On Nov 7, 9:51*pm, Yun <yun.w...@gmail.comwrote:
It sounds like you are really good with DOM and frames. I have tried
to use createElement and then append. It works for DOM element in one
page and across frames. But it doesn't work for FRAME or FRAMESET
itself.
Would you like to provide a sample code to dynamically append new
frame to an existing frameset?

On Nov 7, 2:56*pm, Good Man <he...@letsgo.comwrote:
Yun <yun.w...@gmail.comwrote innews:7b**********************************@d36g20 00prf.googlegroups.com:
Your answer is NOT an answer to my question. It merely explained how
to access frames and their elements from JavaScrpt.
What I am looking for is to CREATE new frames in a empty frameset with
JavaScript functions.
learn about the DOM. *innerHTML is not the way to go.
you'll need to brush up on JS anyways, just trying random stuff like
"document.frames.SV" isn't going to get you anywhere. *of course, if you
DID read that link, you'd know how to properly access your frame named SV.
Of course!

function makeNewFrame(parentFrameId,newFrameId,targetUri) {
var newFrame = document.createElement("frame");
newFrame.id = newFrameId;
newFrame.name = newFrameId;
newFrame.src = targetUri;

var frameset = document.getElementById(parentFrameId);

frameset.appendChild(newFrame);
}

I am also remembering that you must bear in mind that a frameset
generally has a rows and cols property, which defines the initial
distribution. If you are adding new frames, you will need to amend
these, otherwise no space will be allocated to the new frame and thus
it won't be visible.

You can access these like so:

frameset.rows = "80, *, *"; // etc..etc..

Same for the cols property. Which you can set to null if you just
want these frames to appear one above the other.

Stefan
Nov 7 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.