日期:2014-05-16  浏览次数:20384 次

使用javascript设置页面值的一个问题

最近在使用javascript,使用iframe框架,从一个页面调用另一个页面的函数的时候,发现一个问题

	<div style="float: left">
		<iframe   name="middle" src="${pageContext.request.contextPath}/page/user/second_usergroupTree.jsp" width="280px" height="500px" style="border: 0px;overflow: auto" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>
		</div>
		<div id="tt" style="width:750px;height:500px;float: left;margin-left: 20px">
		<div title="基本信息" style="padding:20px;" name="Tab1">
			<iframe name ="tab1Content" id="tab1Content" scrolling="auto" frameborder="0"  
			src="${pageContext.request.contextPath}/groupAction.do?methodName=insert_req" style="width:100%;height:100%;"></iframe>
		
		</div>
		<div title="角色"  style="padding:20px;" name="Tab2">
			<iframe name ="tab2Content"id="tab2Content" scrolling="auto" frameborder="0"  src="${pageContext.request.contextPath}/roleAction.do?methodName=userRole_query&userid=" style="width:100%;height:100%;"></iframe>
		</div>
		<div title="权限"  style="padding:20px;" name="Tab3">
			<iframe name ="tab3Content"id="tab3Content" scrolling="auto" frameborder="0"  src="${pageContext.request.contextPath}/page/resource/user_resourceTree.jsp" style="width:100%;height:100%;"></iframe>
		</div>
	</div>

?我是从middle页面给tab1Content页面内容传值

	window.parent.document.getElementById("tab1Content").src = "${pageContext.request.contextPath}/page/user/user.jsp";
				
	window.parent.document.getElementById("tab1Content").contentWindow.fillForm("","insert",node.id,"12","12","34");
				

但是tab1Content页面内容的值并没有设置为函数中的值,

?

?然后发现tab1Content页面的函数fillForm被调用了,但是后来又被设置为空了,可能是文档加载完成后,把原先的值覆盖掉了吧,具体原因我也不太清楚。

?

?

?