jquery load()在firefox(火狐)下显示不正常的解决方法


复制代码 代码如下:

<html>
<head>
<script type="text/javascript" src="jquery-1.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#b01").click(function(){
$('#myDiv').load('http://www.baidu.com');
});
});
</script>
</head>
<body>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button id="b01" type="button">Change Content</button>
</body>
</html>

把 http://www.baidu.com 改为"saa.txt"则正常
分析 觉得应该是由于 直接将http://www.baidu.com的内容放到div中,对于较严格的FireFox可能不会处理
用cssviewter查看处理后的页面源码果然发现div中为空
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3