语法:
with(object)
statements
参数
新的默认对象
statements
一个或多个语句,object是该语句的默认对象
description:with 语句通常用来缩短特定情况下必须写的代码量
x=Math.cos(3*Math.PI)+Math.sin(Math.LN10)
y=Math.tan(14*Math.E)
使用with后
with(Math){
x=cos(3*PI)+sin(LN10)
y=tan(14*E)
<script type="text/javascript”>
var name="chen.hui";
var b=function(){
this.name="laruence";
this.age=24;
}
var p=new b();
widh(document){
write(name+“<br/>”);
with(p){
write(age+"<br/>");
write(name);
}
}
</script>
</script>