javascript—with用法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript—with用法相关的知识,希望对你有一定的参考价值。

function Lakers() {  

       this.name = "kobe bryant";  

       this.age = "28";  

       this.gender = "boy";  

}  

var people=new Lakers();  

with(people)  

{  

       var str = "姓名: " + name + "<br>";  

       str += "年龄:" + age + "<br>";  

       str += "性别:" + gender;  

       document.write(str);  


以上是关于javascript—with用法的主要内容,如果未能解决你的问题,请参考以下文章

javascript—with用法

javaScript中forwith日期的用法

JavaScript事件代理和委托

JavaScript中“javascript:void ”是什么意思

定义8:jquery.cookie用法详细解析

JS中事件代理与委托