with Statementwith (object)
statements
Arguments
object
The new default object.
statements
One or more statements for which object is the default object.
Res
The with statement is commonly used to shorten the amount of code that you have to write in certain situations. In the example that follows, notice the repeated use of Math. x = Math.cos(3 * Math.PI) + Math.sin(Math.LN10)
y = Math.tan(14 * Math.E)
When you use the with statement, your code becomes shorter and easier to read: with (Math){
x = cos(3 * PI) + sin (LN10)
y = tan(14 * E)
}
Requirements
Version 1See Also
this Statement--------------------------------------------------------------------------------Send feedback to Microsoft© 2001 Microsoft Corporation. All rights reserved.
statements
Arguments
object
The new default object.
statements
One or more statements for which object is the default object.
Res
The with statement is commonly used to shorten the amount of code that you have to write in certain situations. In the example that follows, notice the repeated use of Math. x = Math.cos(3 * Math.PI) + Math.sin(Math.LN10)
y = Math.tan(14 * Math.E)
When you use the with statement, your code becomes shorter and easier to read: with (Math){
x = cos(3 * PI) + sin (LN10)
y = tan(14 * E)
}
Requirements
Version 1See Also
this Statement--------------------------------------------------------------------------------Send feedback to Microsoft© 2001 Microsoft Corporation. All rights reserved.
解决方案 »
- 新手 求个JS 点击单选按钮 显示2个不同DIV
- 用html写的一个静态表格,如何自动的更新数据
- 大家好啊,谁能帮我找出下面代码的连接文件,和帮我解读下面代码的原意思呢,谢谢了...
- 怎样捕获 ie弹出保存对话框的事件???
- 关于省市县三级联动下拉框的修改功能?
- 关于几个同级iframe使用同名变量的疑惑——
- 高手请进~! 表单提交的问题 。
- 求一函数,如何格式化一字符串?
- 如何实现在showModalDialog()提交不弹出新网页??怎么用net_lover(孟子E章)的方法好象不管用,请高手指点一下!!
- grid中添加一列按钮,点击按钮后获取那列的某个属性传到后台
- 如何屏蔽刷新功能呀
- 一句话问题 就这一句话 看看错误在什么地方?
{
alert(innerHTML); //等同于 alert(document.body.innerHTML);
}with(document.formName)
{
alert(input1Name.value);
alert(input2Name.value); //原理同上
}
with(学生)
.姓名
.年龄
为语句设定默认对象。 with (object)
statements 参数
object新的默认对象。statements一个或多个语句,object 是该语句的默认对象。说明
with 语句通常用来缩短特定情形下必须写的代码量。在下面的例子中,请注意 Math 的重复使用: 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)
}