tags:

views:

48

answers:

2

Hello, I was wondering if there is any way form me to change the contents of an iframe dynamically.

+1  A: 

Assuming your iframe is named "frame" (<iframe name="frame">)

function loadIframe(url)
{
      document.all.frame.src=url;
      document.all.frame.style.visibility="visible";
}

This allows you to load an URL into there.

If you want to write with javascript into it, you can try

document.all.frame.write("...");

But I don't know if it does work like this, I only know the URL part. Probably does not work, because the iframe is what it is, a frame which displays another document - you could try having a javascript in there that writes what you want. :)

LukeN
A: 

You can change the src of the iframe to new URL.

Teja Kantamneni