0

出于某种原因,当我调用一个函数来创建表单时,下拉菜单不粘,浏览器会强制用户单击第一个文本字段并通过其余的选项卡。它不会让他们鼠标穿过田野。这仅发生在 FF 中,而不是 IE 或 Chrome。我包含的表单只是基本的 html,只有我包含的 php 页面才这样做。

这是一个功能:

function addNoteUI($keyword) {

echo "<div id='search_result_right'>";
echo "<center><div id='enter_note_header'>Assign a Salesperson</div></center><p>";

echo "<form id='response' action='notes_add.php' method='post'>";

echo "<label for='mod_num'>MOD Initials: <label>";
echo "<input type='text' name='mod_num' size='2' maxlength='4'><p>";

echo "<label for='sales_num'>Assigned to Sales Person: <label>";
echo "<input type='text' name='sales_num' size='2' maxlength='4'><p>";

echo "<input type='hidden' name='question_num' value='$keyword'>";

echo "<label for='response'>Note</label><br>";
echo "<textarea name='response' cols='30' rows='7 maxlength='510'></textarea><p>";

echo "<input type='submit' value='Assign'>";
echo "</form>";

echo "</div>";

这是另一个:

function changeDept() {
include 'ask_search.php';
echo "<div id='search_result'>";
echo "<form action='change_dept.php' method='post'>";

echo "<label for='current_num'>Enter the Question Number to be Changed: <label>";
echo "<input type='text' name='current_num' size='4'><p>";

echo "<label for='store'>Select New Store/Department: <label>";
echo "<select name='store'>";
    echo "<option>Please Select</option>";
    echo "<option value='Albany'>Sales (Albany Store)</option>";
    echo "<option value='Saratoga'>Sales (Saratoga Store)</option>";
    echo "<option value='Web Sales'>Sales (TaftFurniture.com)</option>";
    echo "<option value='Financing'>Financing</option>";
    echo "<option value='Customer Service'>Customer Service</option>";
    echo "<option value='Delivery'>Delivery</option>";
    echo "<option value='HR'>Human Resources</option>";
    echo "<option value='Web Contact'>Website Comment</option>";
    echo "<input type='submit' value='Change' id='dropdown'>";
echo "</select></form></div>";

} 提前致谢。

4

1 回答 1

4

您的标签未正确关闭:

echo "<label for='mod_num'>MOD Initials: <label>";

应该:

echo "<label for='mod_num'>MOD Initials: </label>";

此外,在第二个示例中,您在 select 中有一个输入。输入必须在外部:

    echo "<option value='Web Contact'>Website Comment</option>";
    echo "<input type='submit' value='Change' id='dropdown'>";
echo "</select></form></div>";

应该:

    echo "<option value='Web Contact'>Website Comment</option>";
echo "</select>";
echo "<input type='submit' value='Change' id='dropdown'></form></div>";

还有一个,你没有关闭你的 P 标签:

echo "<input type='text' name='mod_num' size='2' maxlength='4'><p>";

应该:

echo "<p><input type='text' name='mod_num' size='2' maxlength='4'></p>";

尝试更加小心您的标签。一些浏览器对格式错误的 HTML 更宽容,但其他浏览器则不然。

于 2013-07-08T14:36:26.917 回答