如何獲取中的src屬性

 這裏寫了一個獲取iframe中的src的url地址並將其修改的例子

	<script type="text/javascript" >
	var redurl;
    $(document).ready(function() {
	 redurl=$('#redirt').attr("value");
	 	$('#titles').find('a').removeClass('here');
	 	$('#zuche').addClass('here');
	});
	
	window.onload = (function () {
	var iObj = document.getElementById('ifm');
	if(redurl!=null && redurl!=''){
	iObj.src=redurl;
	}
	//alert("1:"+redurl);
	//alert("2: "+iObj.src);
	}); 
	
	document.getElementById('ifm').location.reload();
 
	</script>

	

 

<body class="body" style="text-align: center;"> 
		<span  id="redirt" value="${redirectURL}"></span>
		<div id="wape">
		<jsp:include page="/WEB-INF/head.jsp"></jsp:include>
		<iframe  id = "ifm" src="http://www.demo.com/demo.aspx?pid=108048 " frameborder="0" width="1000px;"   style="text-align: center; height: 800px" scrolling="auto"    >
		
		</iframe>		
		
		<jsp:include page="/WEB-INF/bottom.jsp"></jsp:include></div>
</body>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章