JavaScript对象
<script language="javascript"> //js中定义了一个构造器 function Person(){ } var person1=new Person(); person1.age=18; person1.name="wangyec"; alert(person1.age+"-----"+person1.name); //还可以通过以下方式来访问对象的属性 alert(person1["name"]+"------->"+person1["age"]); //还可以动态的生成JavaScript代码 eval("alert(person1.name);"); //动态生成js的好我们可以控制代码生成 var x="name"; eval("alert(person1."+x+");"); //另外在动态生成代码时,我试了以下似乎只可以以点的方式来访问属性。 </script>
html frameSet
<html> <head> </head> <frameset rows="50%,50%"> <frame name="top" src="IP的验证.html"> <frame name="bottom" src="javascript_1.html"> </frameset> <> </html>
操作frame
//在top 页面中刷新bottom页面的方法1 <input type="button" value="刷新" οnclick="window.parent.frames[1].location.reload()"/> //在top 页面中刷新bottom页面的方法2 <input type="button" value="刷新" οnclick="parent.frames.bottom.location.reload()"/> //在top 页面中刷新bottom页面的方法3 <input type="button" value="刷新" οnclick="parent.frames['bottom'].location.reload()"/> //在top 页面中刷新bottom页面的方法4 <input type="button" value="刷新" οnclick="parent.frames.item(1).location.reload()"/> //在top 页面中刷新bottom页面的方法5 <input type="button" value="刷新" οnclick="parent.frames.item('bottom').location.reload()"/> //在top 页面中刷新bottom页面的方法6 <input type="button" value="刷新" οnclick="parent.bottom.location.reload()"/> //在top 页面中刷新bottom页面的方法7 <input type="button" value="刷新" οnclick="parent['bottom'].location.reload()"/>相关资源:某人初学javascript的时候写的学习笔记