Jump to content

Archived

This topic is now archived and is closed to further replies.

BluePhoenixNC

javascript: 'dynamic iframe and location' -- possible ?

Recommended Posts

My appologies, I am not a JS junkie and just starting out with the whole thing so please be patient with me.
I was wondering if it is possible to create an iframe in Javascript dynamically. have it load a certain page based on a variable and, assign the iframe a CSS class (which is to determine the height and width of that frame as opposed to have to go through the js code and change those attributes) and place the whole thing into a specified div container.
here is what I had so far:
[code]function createFrame(url) {
  var placeDIV = document.getElementById("placeme");
  var xIFrameElement = document.createElement("iframe");
  xIFrameElement.frameBorder = 0;
  xIFrameElement.name = "someFrame";
  xIFrameElement.id = "someFrame";
  xIFrameElement.class = "frameclass"; //not sure about that one if this is valid
  xIFrameElement.location = url; //not sure either
  placeDiv.appendChild = (xIFrameElement);
}
[/code]
But it just does not 'activate' and I am not sure how to proceed.

Any help is greatly appreciated.

Thanks

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.