Msg#: 4386031 posted 6:19 pm on Nov 14, 2011 (gmt 0)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Sample Page</title> </head> <body> <div id="container"></div>
// create an iframe node and set its attributes var ifrm = document.createElement('iframe'); ifrm.setAttribute('width','800'); ifrm.setAttribute('height','600'); ifrm.setAttribute('frameborder','0'); ifrm.setAttribute('href', ifrmUrl );
// attach the iframe to the container div var finito=document.getElementById('container'); finito.appendChild(ifrm);
</script> </body> </html>
I took the liberty of changing your variable called "url" to ifrmUrl because it always makes me nervous using common coding terms as variable names, so I always avoid variable names like index,url,a,div etc.
Msg#: 4386031 posted 1:15 am on Nov 15, 2011 (gmt 0)
I suspect there's a tidier way to set all those attributes. I'll have a dig around.
Well I did dig around a little (searched using "setting multiple attributes setattribute") but it seems that for a one-off usage like yours, the process I outlined is about right. There are ways to build reusable models but I don't think that's where you're heading.