出于某种原因,当我调用函数来创建表单时,下拉菜单不会粘滞,浏览器会强制用户单击第一个文本字段并选择其余部分。它不会让他们鼠标穿过田野。这只发生在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>";
} 提前谢谢。
答案 0 :(得分: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更加宽容,但其他浏览器则不然。