Forum Moderators: open
<!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>
<script type="text/javascript">
var url = "http://www.example.com/";
var content = "<iframe width='800' height='600' frameborder='0' src='" + url + "'><\/iframe>";
document.getElementById("container").innerHTML = content;
</script>
</body>
</html>
<!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>
<script type="text/javascript">
// set up your iframe url
var ifrmUrl = "http://www.example.com/";
// 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>
ifrm.setAttribute('id','myFrame'); I suspect there's a tidier way to set all those attributes. I'll have a dig around.