Firefox 立即自动关闭表单

发布于 2024-12-07 00:47:03 字数 1495 浏览 0 评论 0原文

编辑:已修复,我刚刚删除了表格并将其设为无表格,它需要一些 css 来对布局进行排序,但可以跨浏览器工作,谢谢大家。

我有一个非常奇怪的问题,我'我正在尝试在 oscommerce 中制作 AJAX 快速订单表格。除了这段代码之外,一切都很顺利:

while ($sql_results = tep_db_fetch_array($sql_query)) {

    $sout2 = "<tr>";
    $sout2 .= '<form id="pp'. $sql_results['products_id'] . '" method="get" action="quickorder.php"></tr><tr>';
    $sout2 .= "<td valign=\"top\" width=\"100\"><b><a href=\"" . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $sql_results['products_id']) . "\">" . $sql_results['products_model'] . "</a></b></td>";
    $sout2 .= "<td valign=\"top\" width=\"300\">" . $sql_results['products_name'] . "</td>";
    //$sout .= "<td valign=\"top\" width=\"100\">" . tep_image(DIR_WS_IMAGES . $sql_results['products_image'], $sql_results['products_name'], 50, 50) . "</td>";
    $sout2 .= "<td valign=\"top\" width=\"150\"><input type=\"hidden\" id=\"pid\" name=\"pid\" value=\"" . $sql_results['products_id'] . "\" /><input id=\"pqty\" name=\"pqty\" type=\"text\" value=\"1\" /></td>";
    $sout2 .= "<td valign=\"top\" width=\"50\"><input type=\"submit\" value=\"Add\" /></td>";
    $sout2 .= "</form>";
    $sout2 .= "</tr>";
    echo $sout2;
}

这使得 Firefox 立即关闭表单标签:

<form id="pp266" method="get" action="quickorder.php"></form>

IE 正确地处理表单。

EDIT : Fixed, I just removed the tables and made it tableless, it will require abit of css to sort the layout but is working cross browser, thank you everyone.

I have a really weird issue, I'm trying to do a AJAX quick order form in oscommerce. All is going well apart from this code:

while ($sql_results = tep_db_fetch_array($sql_query)) {

    $sout2 = "<tr>";
    $sout2 .= '<form id="pp'. $sql_results['products_id'] . '" method="get" action="quickorder.php"></tr><tr>';
    $sout2 .= "<td valign=\"top\" width=\"100\"><b><a href=\"" . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $sql_results['products_id']) . "\">" . $sql_results['products_model'] . "</a></b></td>";
    $sout2 .= "<td valign=\"top\" width=\"300\">" . $sql_results['products_name'] . "</td>";
    //$sout .= "<td valign=\"top\" width=\"100\">" . tep_image(DIR_WS_IMAGES . $sql_results['products_image'], $sql_results['products_name'], 50, 50) . "</td>";
    $sout2 .= "<td valign=\"top\" width=\"150\"><input type=\"hidden\" id=\"pid\" name=\"pid\" value=\"" . $sql_results['products_id'] . "\" /><input id=\"pqty\" name=\"pqty\" type=\"text\" value=\"1\" /></td>";
    $sout2 .= "<td valign=\"top\" width=\"50\"><input type=\"submit\" value=\"Add\" /></td>";
    $sout2 .= "</form>";
    $sout2 .= "</tr>";
    echo $sout2;
}

This makes firefox close the form tags straight away:

<form id="pp266" method="get" action="quickorder.php"></form>

IE does the forms correctly.

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

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

发布评论

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

评论(1

雪若未夕 2024-12-14 00:47:03

彻底检查您的标记。你有这样的东西,

<tr><form ...></tr>

这会立即关闭 tr,导致所有嵌套元素也关闭(FF 行为,IE 行为不同)。因此,替换

$sout2 .= '<form id="pp'. $sql_results['products_id'] . '" method="get" action="quickorder.php"></tr><tr>';

$sout2 .= '<form id="pp'. $sql_results['products_id'] . '" method="get" action="quickorder.php"><tr>';

另外,将表单移到行外可能是一个好主意,因为某些浏览器不允许 form 标记出现在 tr 内,只允许 <代码>td和th

Examine your markup thoroughly. You have something like

<tr><form ...></tr>

This closes the tr right away, causing all nested elements to close as well (FF behaviour, IE behaves differently). So, replace

$sout2 .= '<form id="pp'. $sql_results['products_id'] . '" method="get" action="quickorder.php"></tr><tr>';

with

$sout2 .= '<form id="pp'. $sql_results['products_id'] . '" method="get" action="quickorder.php"><tr>';

Also, it might be a good idea to move the form outside the row, as some browsers do not allow form tag to appear inside the tr, only td and th.

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