jQuery 加载导致 Opera 浏览器加载整个页面

发布于 2024-10-03 23:01:39 字数 749 浏览 1 评论 0原文

这是我的页面中存在问题的部分:

<div id="notice_box" class="center">
  <div id="notice_cont"></div>
<script>
    function notice(more)
    {
        $('#notice_cont').load('notice.php?more_notice='+more);
    }
</script>
</div>
    <div id="notice_box_foot">
   <img src="images/notice-box-bl.png" class="left">
   <img src="images/notice-box-br.png" class="right">
 </div>
</div>

它被这样调用:

<a style="margin-right:5px;" class="right" href="javascript:notice(3);"><img src="images/not-less.png" /></a>

该脚本应该用 notice.php 填充 #notice_cont...而不是它填充整个页面...在除 Opera 之外的所有浏览器中都可以正常工作!也没有错误。

Here is the part of my page with the problem:

<div id="notice_box" class="center">
  <div id="notice_cont"></div>
<script>
    function notice(more)
    {
        $('#notice_cont').load('notice.php?more_notice='+more);
    }
</script>
</div>
    <div id="notice_box_foot">
   <img src="images/notice-box-bl.png" class="left">
   <img src="images/notice-box-br.png" class="right">
 </div>
</div>

It gets called like this:

<a style="margin-right:5px;" class="right" href="javascript:notice(3);"><img src="images/not-less.png" /></a>

The script is supposed to fill #notice_cont with notice.php... rather it fills the whole page with it... works fine in all browsers except Opera! There are no errors either.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ら栖息 2024-10-10 23:01:39

我建议更改 标记:

<a style='margin-right: 5px' class='right' href='#' onclick='notice(3); return false'><img ...></a>

以确保 标记本身的默认行为不会发生。

I would suggest changing that <a> tag:

<a style='margin-right: 5px' class='right' href='#' onclick='notice(3); return false'><img ...></a>

to make sure that the default behavior of the <a> tag itself does not happen.

潜移默化 2024-10-10 23:01:39

您是否尝试过验证notice.php的输出?由于您没有显示此标记,我只是在这里猜测,但我猜想该标记格式错误,因此 Opera 无法正确插入它。

Have you tried validating the output of notice.php? Since you haven't shown this markup I'm just guessing here, but I'd guess that the markup is malformed and Opera thus doesn't insert it correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文