js4:with,for in语句,windows,location对象的使用

原文发布时间为:2008-11-08 —— 来源于本人的百度文章 [由搬家工具导入]

<html>
<head>
<title>js</title>
<script type="text/JavaScript">
<!--
function Car(make,model,color){
this.make=make;
this.model=model;
this.color=color;
}

function openthat(){
window.open("js3.html","that","height=300,width=400,toolbar=yes,scrollbars=yes,directories=yes,location=yes menubar=yes,resizable=no,status=yes");
}

function timeout(){
document.write("time over");
}

function showdate(){
var dt=new Date();
document.getElementById("stime").innerText=dt.getSeconds();
}
var st=setInterval("showdate();",1000);

//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">
<!--

-->
</style></head>
<body background="../../图片/女孩子啊/de4149086dd0f2c562d98610.jpg">
<script type="text/JavaScript">
<!--
var car=new Car();
car.make="china";
car.model="003";
car.color="red";
for(var prop in car){
if(prop=="model")
     continue;
document.write(prop+"="+car[prop]+"<br>");

}
var car2=new Car();
with(car2){
make="English";
model="009";
color="yellow";
}
for(var prop in car2){
   document.write(prop+"="+car2[prop]+"<br>");
}

//var tm=setTimeout("timeout();",3000);


//-->
</script>

<a href="#" onClick="openthat();">js3de</a>
<br>
<a href="#" onClick="window.open('js3.html');">open</a>
<input type=button name="quit" value="close" onClick="window.close();">
<!-- <input type=button name="not" value="donot" onClick="clearTimeout(tm);"> -->
<p>&nbsp;</p>
<p><span id="stime"></span>
<input type=button name="stop" value="stop" onClick="clearInterval(st);">
<input type="button" name="goto" Value="GO TO" onClick="parent.js3.location.href='http://www.baidu.com'">
    <input type="button" name="goto" Value="Reflesh" onClick="parent.location.reload(true);">
<input type="button" name="goto" Value="Replace" onClick="parent.js3.location.replace('http://www.baidu.com');">
<input type="button" name="who" Value="frames" onClick="parent.frames[1].location.replace('http://www.baidu.com');">

</p>
<p>&nbsp; </p>
</body>
</html>

原文地址:https://www.cnblogs.com/handboy/p/7148413.html