87,904
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<script type="text/javascript">
function A(){
this.x = 6;
this.y = 7;
alert(this.x);
}
c = 1;
var b = 5;
var x = 5;
//var a = new A();
</script>
</head>
<body>
<input id = "readme" type = "text" value="helloworld"></input><br>
<script>
window.onload=function(){
//var str="<iframe width=400 height=300 frameborder='yes' scrolling='no' style='position:absolute'></iframe>";
//document.write(str);
var iframe = document.createElement('iframe');
iframe.width = 400;
iframe.height = 300;
iframe.frameborder = 'yes';
iframe.scrolling='no';
iframe.style.position = 'absolute';
document.body.appendChild(iframe);
var mystr = "";
mystr += "<html>";
mystr += " <head>";
mystr += " <script type='text/javascr" + "ipt'>";
mystr += " function func(){";
mystr += " var x=parent.b;document.getElementsByTagName('input')[0].value=x;";
mystr += " }";
mystr += " </" + "scr" + "ipt>";
mystr += " </head>";
mystr += " <body>";
mystr += " <input type='button' value='' onclick='func();'></input>";
mystr += " </body>";
mystr += "</head></html>";
window.frames[0].document.open();
window.frames[0].document.write(mystr);
window.frames[0].document.close();
}
</script>
<p>一些老的浏览器不支持 iframe。</p>
<p>如果得不到支持,iframe 是不可见的。</p>
</body>
</html>