<div class="htmlarea"> <textarea id="runcode49897"> <script> function Employee(name, age, title, salary)//括号里的东东是参数,还是属性?如何遍历? { this.name = name; this.age = age; this.title = title; this.salary = salary; this.promotion = promotion; } function promotion(new_title,percent_raise) { var salary_increase = this.salary * percent_raise; this.salary = this.salary + salary_increase; this.title = new_title; } function newdx(){ var aq=new Employee("aq",22,"qigai",3000) alert(aq.name+"的职业是"+aq.title+",薪水是"+aq.salary) aq.promotion("bangzhu",1) alert(aq.name+"的新职业是"+aq.title+",薪水是"+aq.salary) } newdx() </script> </textarea><br><input onclick="runEx('runcode49897')" type="button" value="运行代码"> <input onclick="doCopy('runcode49897')" type="button" value="复制代码"> <input onclick="doSave(runcode49897)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div> <br><span class="bold"><strong>诘屈聱牙</strong></span><br><div class="htmlarea"> <textarea id="runcode16684"> <script> function hutia(){ for(var i=0;i<arguments.length;i++)document.write(arguments[i]+","); document.write(" "); } hutia(1,2,3,4); hutia("haha","hehe", true, false); hutia("Show me the money", "Operation cwal", "Food for thought", "the gathering"); </script> </textarea><br><input onclick="runEx('runcode16684')" type="button" value="运行代码"> <input onclick="doCopy('runcode16684')" type="button" value="复制代码"> <input onclick="doSave(runcode16684)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>