码迷,mamicode.com
首页 > Web开发 > 详细

js中with的作用

时间:2019-05-30 16:19:00      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:asc   type   需要   java   text   inner   blank   var   aaa   

js中with的作用当一个对象有多个需要操作的属性或方法时,可以使用

<体>
试验
<script type=“text/javascript”>
var o=文件。创建元素(“DIV”);
(o){
风格。cursor=“指针”;
style.zindex=“100”;
innerhtml=“aaaaa”;
}
文件。身体。附录子项(o);
</Script >
<正文>
上述代码相当于
<体>
试验
<script type=“text/javascript”>
var o=文件。创建元素(“DIV”);
风格。cursor=“指针”;
o.style.zindex=“100”;
o.innerhtml=“aaaaa”;
文件。身体。附录子项(o);
</Script >
<正文>
因此,with用于简化代码操作。

js中with的作用

标签:asc   type   需要   java   text   inner   blank   var   aaa   

原文地址:https://www.cnblogs.com/blogst/p/10949995.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!