使用jQuery让iframe自动加载

主要是用到jQuery里面的$('#XXX').attr("src","urlstr");方法,把指定的urlstr赋给操作元素的src属性

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sx" uri="/struts-dojo-tags"%>
<!--DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"-->
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title></title>
	<script type="text/javascript" src="/demo/js/jquery.js"></script>		
	<script type="text/javascript">
		jQuery.noConflict();	
		function initFirstTab(){
				jQuery('#user_bottom').attr("src", "/abc/def/queryFirstTab.action");
		}
	</script>
	</head>
	<body onload="initFirstTab()">
	...
	<iframe name="user_bottom" id="user_bottom" frameborder="0" scrolling="no" width="100%" height="400"></iframe>
</body>
</html>

你可能感兴趣的:(java,html,jquery,struts,dojo)