Esempio:
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript">
window.onload=function(){
setTimeout(function(){
var spazioFrame = document.getElementById('ContenitoreFrame');
spazioFrame.innerHTML='';
var iframe = document.createElement("iframe");
iframe.id='Frame';
iframe.setAttribute("src","http://www.html.it");
spazioFrame.appendChild(iframe)},
5000)
}
</script>
<style type="text/css">
#contenitore{
width:800px;
height:500px;
border:#999 solid 1px;
}
#ContenitoreFrame{
width:794px;
height:400px;
border:#CCC solid 1px;
margin-right: auto;
margin-left: auto;
}
#Frame{
width:100%;
height:400px;
border:none;
}
</style>
</head>
<body>
<div id="contenitore">Contenitore
<div id="ContenitoreFrame">Attendere caricamento iframe...</div>
</div>
</body>
</html>