【发布时间】:2012-03-09 09:46:12
【问题描述】:
这是我的设置...
我有两个页面,index.html 和 cart.html。我在 index.html 上有一个表单,提交时会在弹出的 iframe 中加载 cart.html。这很好用。
当我将 cart.html 加载到 iframe 中时,它会加载整个 cart.html 页面,显示与 index.html 相同的页眉/菜单/背景。但这是一个问题,我需要能够将 cart.html 加载到 iframe 中,然后定位一个 ID 为“cart-content”的 div。我只需要显示那个 div 而不是整个页面。
解决方法是对cart.html 进行样式化,使其适合iframe,而没有标题/菜单/背景,但我需要能够在iframe 之外访问cart.html。
这是我的表格:
<form id="product-form" method="post" action="/cart">
<!-- BIG CARTEL CONTENT, NOT IMPORTANT -->
</form>
我正在使用 jQuery 插件 FaceBox 打开 iFrame。这是它的代码:
jQuery('#product-form').submit(function() {
jQuery.facebox('<iframe name="targetbox"></iframe>');
return true;
}).prop('target','target box')
所以在表单中我需要它的行为类似于“/cart#cart-content”有意义吗?希望有人能帮忙!谢谢
【问题讨论】:
-
.prop('target','target box')是什么?? -
加载 iframe 是 Facebox 代码的一部分。