我在IE中运行我的网页时遇到此错误(代码在其他浏览器中运行正常)。JavaScript错误“访问被拒绝”在Internet Explorer中
这是HTML代码:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body>
<--- some html code --->
<iframe src='http://localhost/page1.php' style="background: transparent; overflow: hidden; height: 210px; width: 390px;" frameborder="0" />
</body>
</html>
这是page1.php中
<!DOCTYPE html>
<html>
<body>
<form action="usercheck.php" method="POST">
USERNAME:<input name="uname" id="uname" type="text" maxlength="12" required/>
<input type="submit" value="Submit">
</form>
</body>
</html>
这是usercheck.php
<?php
//some php code
?>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body>
<--- some html code --->
</body>
</html>
的问题是,当达到usercheck.php
点击后在提交按钮page1.php
我得到错误http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js. Access is denied.
这里是错误图像:http://i.stack.imgur.com/diCoF.jpg。然后因此我得到'$'符号未定义的错误(这是由于未能加载jquery库)。
EDIT- 我试过在我的服务器中包括jquery文件,但仍然出现错误。我也试过这个代码usercheck.php:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
/*! jQuery v1.10.1 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
//and the rest of the jquery library...
</script>
</head>
<body>
<--- some html code --->
</body>
</html>
我得到这个时候的错误是这样的:http://i.stack.imgur.com/hR9aN.jpg(usercheck2.php的原名是rscheck.php在我的服务器)。然后因此我得到'$'符号未定义的错误(这是由于未能加载jquery库)。如果我直接打开page1.php的内容(通过url- localhost/page1.php),那么一切正常。
这是我使用的JQuery其唯一代码:
if($("#pret").contents().text().search("NAMECHECK: NOTAVALIBLE")!=-1)
我可以排除只有我可以将此代码转换为JavaScript的jQuery的。
是互联网可以让你.. ?? – Pranav
'usercheck.php'是否加载到iframe中? – ExceptionLimeCat
yes if iframe – Sid