带有 Facebox 的 Onclick 在 IE8 中不起作用

发布于 2024-12-25 04:54:44 字数 462 浏览 1 评论 0原文

我正在开发一个包含 Facebox 的网站,用于加载购物篮流程的内容。

当向购物篮添加一些东西并单击绿色愿望清单按钮时,我在 IE8 中加载它时遇到问题,它适用于所有现代浏览器。谁能明白为什么它不会在 Facebox 中加载 IE8 中的内容吗?

我在愿望清单按钮上使用此代码:

<div onclick="location.href='wishlist.php?basket=true'" rel="msgbox" id="mybasket">

是否有足够的信息来查看网站链接上的源代码?如果您需要更多代码,请询问。

在使用 Chrome 的 Mac 上 - 正如您所看到的,当单击绿色心愿单按钮时,facebox 已正常打开。

在使用 IE8 的 PC 上 - 单击绿色愿望清单按钮时,facebox 将打开,但不会加载内容。

I'm working on a website that includes Facebox to load content for a basket process.

When adding something to the basket and clicking the green wishlist button I'm having trouble with it loading in IE8, it works on all the modern browsers. Can anyone see why it won't load content in IE8 in the facebox?

I'm using this code on the wishlist button:

<div onclick="location.href='wishlist.php?basket=true'" rel="msgbox" id="mybasket">

Is it enough info to view source on the link to the site? If you need any more code then please ask.

On a Mac using Chrome - as you can see the facebox has opened fine when clicking on the green wishlist button.

On a PC using IE8 - when clicking on the green wishlist button the facebox opens but doesn't load the content.

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

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

发布评论

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

评论(3

终陌 2025-01-01 04:54:44

这是返回数据的问题,最后有一个额外的

<div id="msgbox_title">Your Wish List<div id="closeme" onclick="jQuery(document).trigger('close.facebox')">x</div></div>
<form method="post" action="wishlist.php">
<div id="msgbox_body" style="max-height:400px;min-height:100px;overflow-y:auto;overflow-x:hidden;">
<input type="hidden" name="updatebasket" value="1" />
<table border="0" cellpadding="0" cellspacing="5" align="center" style="min-width:390px;border-collapse:separate!IMPORTANT;">
<tr><td colspan="5" style="text-align: left;"><strong style="font-size:14px;">Rotunda Vulsellum Forceps</strong></td></tr>  <tr>
        <td style="width: 50px;"><span style="color: #aaa;">Quote:</span></td>
        <td style="width: 50px;"><span style="color: #aaa;">Sample:</span></td>
        <td style="width: 350px;"><span style="color: #aaa;">Description:</span></td>

        <td style="width: 80px;"><span style="color: #aaa;">Pack size:</span></td>
        <td style="width: 40px;"><span style="color: #aaa;">Remove</span></td>
    </tr>

      <tr>
          <!-- <td style="padding:0px 2px;"><input type="textbox" class="textbox" value="3" name="54_59_131" /></td> -->
          <td align="center" valign="middle" style="background-color:#C3DCCD;"><input checked="checked" style="margin:5px;" type="checkbox" name="products-quote[]" value="835" /></td>
          <td align="center" valign="middle" style="background-color:#D3C4DF;"><input checked="checked" style="margin:5px;" type="checkbox" name="products-sample[]" value="835" /></td>

          <td style="font-size:11px;background-color:#efefef;"><p style="margin:0px 0px 5px 0px;padding:5px;"><span style="color:#663399;font-weight:bold;">VFR1001</span> Sterile Single-use Rotunda Vulsellum Forceps, double packed</p></td>
          <td style="font-size:11px;background-color:#efefef;"><p style="margin:0px 0px 5px 0px;padding:5px; font-weight:bold;">10 units</p></td>
          <td align="center"><b><a href="#" onclick="jQuery.facebox({ ajax: 'wishlist.php?basket=true&del=835' })">X</a></b></td>
      </tr>
        </table>
</div>
<script>
function quoteme() {
        $("#msgbox_body").html('<div id="contactform" style="margin-left:20px;margin-right:20px;margin-top:10px;"><form class="form" method="POST" action="http://www.dtrmedical.com"><table border="0"><tbody><tr><td><p class="name"><label for="name">Your Name<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="name" id="name" /></td></tr><tr><td><p class="hospital"><label for="hospital">Hospital/Institution:</label></p></td><td> </td><td><input type="text" name="hospital" id="hospital" /></td></tr><tr><td><p class="department"><label for="department">Department:</label></p></td><td> </td><td><input type="text" name="department" id="department" /></td></tr><tr><td><p class="email"><label for="email">E-mail<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="email" id="email" /></td></tr><tr><td><p class="tel"><label for="tel">Telephone<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="tel" id="tel" /></td></tr><tr><td colspan="3" align="center"><p class="submit"><input style=\"margin-left:27px;cursor:pointer;\" onclick="jQuery.facebox({ ajax: (\'wishlist.php?emailme=true&name=\' + this.form.name.value + \'&email=\' + this.form.email.value + \'&tel=\' + this.form.tel.value + \'&hospital=\' + this.form.hospital.value + \'&department=\' + this.form.department.value) }); return false;" type="submit" value="Send enquiry" name="submit" /></p></td><td> </td><td> </td></tr></tbody></table></form></div>');
        $("#msgbox_actions").html('<input onclick="jQuery.facebox({ ajax: \'wishlist.php?basket=true\' })" type="button" value="Back to Wishlist" />');
}

</script>
<div id="msgbox_actions"><input onclick="quoteme()" type="button" value="Request quote/sample" /> <a class="backtoproducts" href="http://www.dtrmedical.com/products" style="border-bottom-left-radius:5px 5px;border-bottom-right-radius:5px 5px;border-bottom-style:none;border-color:initial;border-left-style:none;border-right-style:none;border-top-left-radius:5px 5px;border-top-right-radius:5px 5px;border-top-style:none;border-width:initial;color:white;font-family:Arial;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;font-size:11px;">Back to products</a></div><!-- <input type="submit" value="Update" /> --><!-- <input onclick="jQuery.facebox({ ajax: 'wishlist.php?emailme=true' })" type="button" value="Save list for later" /> --> <!-- <input type="submit" value="Update Qty's" /> <input onclick="jQuery.facebox({ ajax: 'wishlist.php?basket=true&clearall=true' })" type="button" value="Clear list" /> --></div>
</form>

在以

开头的行中,在注释之后的末尾,是额外的

这是破坏你的 html,IE 不知道如何修复,但其他浏览器可以。

This is a problem with the returned data, You have an extra </div> at the end.

<div id="msgbox_title">Your Wish List<div id="closeme" onclick="jQuery(document).trigger('close.facebox')">x</div></div>
<form method="post" action="wishlist.php">
<div id="msgbox_body" style="max-height:400px;min-height:100px;overflow-y:auto;overflow-x:hidden;">
<input type="hidden" name="updatebasket" value="1" />
<table border="0" cellpadding="0" cellspacing="5" align="center" style="min-width:390px;border-collapse:separate!IMPORTANT;">
<tr><td colspan="5" style="text-align: left;"><strong style="font-size:14px;">Rotunda Vulsellum Forceps</strong></td></tr>  <tr>
        <td style="width: 50px;"><span style="color: #aaa;">Quote:</span></td>
        <td style="width: 50px;"><span style="color: #aaa;">Sample:</span></td>
        <td style="width: 350px;"><span style="color: #aaa;">Description:</span></td>

        <td style="width: 80px;"><span style="color: #aaa;">Pack size:</span></td>
        <td style="width: 40px;"><span style="color: #aaa;">Remove</span></td>
    </tr>

      <tr>
          <!-- <td style="padding:0px 2px;"><input type="textbox" class="textbox" value="3" name="54_59_131" /></td> -->
          <td align="center" valign="middle" style="background-color:#C3DCCD;"><input checked="checked" style="margin:5px;" type="checkbox" name="products-quote[]" value="835" /></td>
          <td align="center" valign="middle" style="background-color:#D3C4DF;"><input checked="checked" style="margin:5px;" type="checkbox" name="products-sample[]" value="835" /></td>

          <td style="font-size:11px;background-color:#efefef;"><p style="margin:0px 0px 5px 0px;padding:5px;"><span style="color:#663399;font-weight:bold;">VFR1001</span> Sterile Single-use Rotunda Vulsellum Forceps, double packed</p></td>
          <td style="font-size:11px;background-color:#efefef;"><p style="margin:0px 0px 5px 0px;padding:5px; font-weight:bold;">10 units</p></td>
          <td align="center"><b><a href="#" onclick="jQuery.facebox({ ajax: 'wishlist.php?basket=true&del=835' })">X</a></b></td>
      </tr>
        </table>
</div>
<script>
function quoteme() {
        $("#msgbox_body").html('<div id="contactform" style="margin-left:20px;margin-right:20px;margin-top:10px;"><form class="form" method="POST" action="http://www.dtrmedical.com"><table border="0"><tbody><tr><td><p class="name"><label for="name">Your Name<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="name" id="name" /></td></tr><tr><td><p class="hospital"><label for="hospital">Hospital/Institution:</label></p></td><td> </td><td><input type="text" name="hospital" id="hospital" /></td></tr><tr><td><p class="department"><label for="department">Department:</label></p></td><td> </td><td><input type="text" name="department" id="department" /></td></tr><tr><td><p class="email"><label for="email">E-mail<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="email" id="email" /></td></tr><tr><td><p class="tel"><label for="tel">Telephone<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="tel" id="tel" /></td></tr><tr><td colspan="3" align="center"><p class="submit"><input style=\"margin-left:27px;cursor:pointer;\" onclick="jQuery.facebox({ ajax: (\'wishlist.php?emailme=true&name=\' + this.form.name.value + \'&email=\' + this.form.email.value + \'&tel=\' + this.form.tel.value + \'&hospital=\' + this.form.hospital.value + \'&department=\' + this.form.department.value) }); return false;" type="submit" value="Send enquiry" name="submit" /></p></td><td> </td><td> </td></tr></tbody></table></form></div>');
        $("#msgbox_actions").html('<input onclick="jQuery.facebox({ ajax: \'wishlist.php?basket=true\' })" type="button" value="Back to Wishlist" />');
}

</script>
<div id="msgbox_actions"><input onclick="quoteme()" type="button" value="Request quote/sample" /> <a class="backtoproducts" href="http://www.dtrmedical.com/products" style="border-bottom-left-radius:5px 5px;border-bottom-right-radius:5px 5px;border-bottom-style:none;border-color:initial;border-left-style:none;border-right-style:none;border-top-left-radius:5px 5px;border-top-right-radius:5px 5px;border-top-style:none;border-width:initial;color:white;font-family:Arial;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;font-size:11px;">Back to products</a></div><!-- <input type="submit" value="Update" /> --><!-- <input onclick="jQuery.facebox({ ajax: 'wishlist.php?emailme=true' })" type="button" value="Save list for later" /> --> <!-- <input type="submit" value="Update Qty's" /> <input onclick="jQuery.facebox({ ajax: 'wishlist.php?basket=true&clearall=true' })" type="button" value="Clear list" /> --></div>
</form>

In the line of starting with <div id="msgbox_actions">, at the end of it after the comments, is the extra </div>

This is breaking your html, which IE doesn't know how to fix, yet other browsers are able to.

一身软味 2025-01-01 04:54:44

可能不是问题,但当我单击按钮时,我的 FireBug 控制台告诉我:

“NetworkError: 404 Not Found - http://dtrmedical.com/xfade2.css"

由于某种原因,它没有找到您的 CSS 文件。

Probably not the problem but my FireBug console tells me this when I click on the button:

"NetworkError: 404 Not Found - http://dtrmedical.com/xfade2.css"

It is not finding your CSS file for some reason or another.

笑着哭最痛 2025-01-01 04:54:44

您的 onclick 事件未正确绑定到您的购物车 div。我不知道到底为什么; IE8 在正确解析复杂的 HTML 属性方面可能存在缺陷。

不要内联定义事件(在 HTML 标签内部),而是尝试通过 jQuery 来完成。将以下代码添加到 $.ready 正文的开头。

$('#mybasket').click(function(){location.href='wishlist.php?basket=true';});

附带说明一下,您应该始终避免在 HTML 中定义任何事件处理,而应采用我上面描述的方法。这样做不仅意味着所有“操作”代码都将位于同一个位置,而且还为您提供了更好的跨浏览器支持(特别是当您利用 jQuery 这样的库时)。

Your onclick event isn't binding properly to your shopping cart div. I'm not sure why, exactly; IE8 may be buggy about parsing complicated HTML attributes like that properly.

Instead of defining the event inline (right inside of the HTML tag), try doing it via jQuery, instead. Add the following code to the beginning of your $.ready body.

$('#mybasket').click(function(){location.href='wishlist.php?basket=true';});

As a side note, you should always avoid defining any event handling in your HTML, instead taking the approach I describe above. Doing so not only means that all of your "action" code will be in once place, but it also affords you greater cross-browser support (especially when you leverage a library like jQuery).

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