`
kevin_wanwei
  • 浏览: 114791 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

初学JavaScript笔记(三)

阅读更多

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="刷新" onclick="window.parent.frames[1].location.reload()"/>
		//在top 页面中刷新bottom页面的方法2
		<input type="button" value="刷新" onclick="parent.frames.bottom.location.reload()"/>
		//在top 页面中刷新bottom页面的方法3
		<input type="button" value="刷新" onclick="parent.frames['bottom'].location.reload()"/>
		//在top 页面中刷新bottom页面的方法4
		<input type="button" value="刷新" onclick="parent.frames.item(1).location.reload()"/>
		//在top 页面中刷新bottom页面的方法5
		<input type="button" value="刷新" onclick="parent.frames.item('bottom').location.reload()"/>
		//在top 页面中刷新bottom页面的方法6
		<input type="button" value="刷新" onclick="parent.bottom.location.reload()"/>
		//在top 页面中刷新bottom页面的方法7
		<input type="button" value="刷新" onclick="parent['bottom'].location.reload()"/>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics