Jump to content


Photo

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


  • Please log in to reply
No replies to this topic

#1 BluePhoenixNC

BluePhoenixNC
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 11 August 2006 - 07:15 PM

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:
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);
}
But it just does not 'activate' and I am not sure how to proceed.

Any help is greatly appreciated.

Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users