动态生成iframe
window.onload=function(){
var iframe = document.createElement("iframe");
iframe.id = "ID_Iframe";
iframe.src = "about:blank";
document.body.appendChild(iframe);
var html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
html+='<html xmlns="http://www.w3.org/1999/xhtml">\n';
html+='<head>\n';
html+='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n';
html+='<title>无标题文档</title>\n';
html+='</head>\n';
html+='<body>\n';
html+='<label id="jueban">lixi</label>\n';
html+='</body>\n';
html+='</html>\n';
var doc;
if(!document.all){
doc = iframe.contentWindow.document;
}else{
doc = window.frames["ID_Iframe"].document;
}
doc.open();
doc.write(html);
doc.close();
};
var iframe = document.createElement("iframe");
iframe.id = "ID_Iframe";
iframe.src = "about:blank";
document.body.appendChild(iframe);
var html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
html+='<html xmlns="http://www.w3.org/1999/xhtml">\n';
html+='<head>\n';
html+='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n';
html+='<title>无标题文档</title>\n';
html+='</head>\n';
html+='<body>\n';
html+='<label id="jueban">lixi</label>\n';
html+='</body>\n';
html+='</html>\n';
var doc;
if(!document.all){
doc = iframe.contentWindow.document;
}else{
doc = window.frames["ID_Iframe"].document;
}
doc.open();
doc.write(html);
doc.close();
};
posted on 2007-11-12 22:56 jueban's space 阅读(1004) 评论(2) 编辑 收藏 举报
【推荐】中国电信天翼云云端翼购节,2核2G云服务器一口价38元/年
【推荐】博客园携手 AI 驱动开发工具商 Chat2DB 推出联合终身会员
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步