您的位置:首页 > 移动开发

[问题-unfinished],怎样使动态改变的js里的document.write任意时间都可以显示在页面上, 问题是不在appendChild前面加一个alert() , append上去的js中的document.write语句通通无效

2007-03-16 10:39 901 查看
<html>
<head>
<title> 问题,怎样使js里的document.write任意时间都可以显示在页面上, 问题是不在appendChild前面加一个alert() , append上去的js中的document.write语句通通无效 </title>
</head>
<body>

<script language="javascript" type="text/javascript">

function set()
{
var vlocation = document.location.href;
varr = vlocation.split( "?" );
params = varr[1];
if( typeof(params)!="undefined" )
{
var arr = params.split("=");
scripturl = arr[1];
if( typeof(scripturl) !="undefined")
{
vsrc = decodeURIComponent(scripturl);
os= document.createElement('script');
os.src = vsrc;
sleep_ttyp();
//alert(vsrc);
document.body.appendChild(os);
//document.body.appendChild(os);
}
}
}

function sleep(num) //JK
{
var tempDate=new Date();
var theXmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
while((new Date()-tempDate)<num )
{
try{
theXmlHttp .open( "get", "about:blank?JK="+Math.random(), false );
theXmlHttp .send();
}
catch(e){;}
}
return;
}

function sleep_ttyp()
{
var xmlServerHttp = new ActiveXObject("Msxml2.ServerXMLHTTP.4.0");
//var xmlServerHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
var lResolve = 5 * 1000;
var lConnect = 5 * 1000;
var lSend = 15 * 1000;
var lReceive = 15 * 1000;
xmlServerHttp.setTimeouts(lResolve, lConnect, lSend, lReceive);
xmlServerHttp.open("GET", "/plus/x.html", false);
xmlServerHttp.send();
}

set();

//document.getElementById('previewJs').src="http://t/plus/list.php?by=top&limit=10&height=20&color=undefined&bgColor=";
</script>

</body>
</html>

<html>
<head>
<title> 问题,怎样使js里的document.write任意时间都可以显示在页面上 </title>
</head>
<body>
<!-- test url http://t/plus/previewList.html?script=%2Fplus%2Flist.php%3Fby%3Dtop%26limit%3D10%26height%3D20%26color%3Dundefined%26bgColor%3D -->
<iframe name="preview" width=420 height=330 frameborder=0 scrolling=auto></iframe>

<script language="javascript" type="text/javascript">

function set()
{
var vlocation = document.location.href;
varr = vlocation.split( "?" );
params = varr[1];
if( typeof(params)!="undefined" )
{
var arr = params.split("=");
scripturl = arr[1];
if( typeof(scripturl) !="undefined")
{
vsrc = decodeURIComponent(scripturl);
var os= document.createElement('script');
os.src = vsrc;

alert(vsrc);
frm = document.frames['preview'];
frm.document.open();
frm.document.write( "<html>\n<body><div></div>\n</body>\n</html>" );
frm.document.close();

alert(frm.document.body.innerHTML);

frm.document.body.appendChild(os);
frm.document.open();
frm.document.close();
}
}
}

set();
//$('previewJs').src="http://t/plus/list.php?by=top&limit=10&height=20&color=undefined&bgColor=";
</script>

</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: