javascript的with表示什么?
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/09/21 03:15:03
javascript的with表示什么?
当你有一个对象的多个属性或者方法需要操作时,就可以使用with
比如
test
var o=document.createElement("div");
with(o){
style.cursor="pointer";
style.zIndex="100";
innerHTML="aaaa";
}
document.body.appendChild(o);
上面的代码相当于
test
var o=document.createElement("div");
o.style.cursor="pointer";
o.style.zIndex="100";
o.innerHTML="aaaa";
document.body.appendChild(o);
所以with 用于简化 代码 操作.
比如
test
var o=document.createElement("div");
with(o){
style.cursor="pointer";
style.zIndex="100";
innerHTML="aaaa";
}
document.body.appendChild(o);
上面的代码相当于
test
var o=document.createElement("div");
o.style.cursor="pointer";
o.style.zIndex="100";
o.innerHTML="aaaa";
document.body.appendChild(o);
所以with 用于简化 代码 操作.
javascript的with表示什么?
javascript中的with(document){}
标签中href="javascript:;"表示什么意思?
javascript:login()什么意思
JavaScript:这里的JavaScript是什么意思呢?
请教javascript的%数字相加
javascript里面的alert()是什么意思?
JavaScript里的document.open();和document.close();到底什么作用,documen
javascript中offset什么意思啊?如下arguments.callee.offset中offset的具体含义
javascript中 $符号的意思 比如element = $(element);什么意思?
to和with表示伴随的时候有什么区别...
Dancing with Wilber Pan 的will表示什么?