How can I dynamically create a source for a frame using javascript?
Let's say I have one html page with frames. The left frame is simply a list of links that will appear in the right frame. Is it possible using javascript to generate the left frame content on page load?
0
grieve
source
to share
2 answers
parent.frameName.document.body will be the body element of this frame, you can use DOM methods (.createElement, .appendChild, .insertBefore) or .innerHTML to fill the frame with content.
+1
jishi
source
to share
Sure. You can use javascript document.write()
or (as I prefer) keep an empty container (DIV) in the left frame and insert your HTML in its property innerHTML
(also via javascript).
+1
Kon
source
to share