我正在尝试构建ajax反馈表单,但我在显示时遇到问题。反馈图像显示,但是当我点击它时没有任何反应。反馈表不显示
我的表格:
<div id="feedback">
<img id="feedback_link" src="images/feedback.gif" href="javascript:open('feedback_form_wrapper');" />
<div id="feedback_form_wrapper" style="display:none;">
<a class="close light" style="float:right;margin-right:5px;" href="javascript:open('feedback_form_wrapper');" >CLOSE</a>
<form id="feedback_form" action="." onsubmit="submit(); return false;">
<div style="margin: 8px; width: 184px; float: left;">
<select name="subject">
<option value="bug">Found A Bug</option>
<option value="typo">Found A Typo</option>
<option value="other">Other</option>
</select>
Email:<br/>
<input type="text" class="email" name="email" /><br/>
<textarea name="body" id="feedback_body" style="height: 180px; margin-top: 8px;">Enter Feedback Here.</textarea>
<input type="submit" class="input_submit_button" value="submit" />
</div>
</form>
</div>
</div>
中的JavaScript:
function open(id){
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'block';
}
else {
if (document.layers) { // Netscape 4
document.id.display = 'block';
}
else { // IE 4
document.all.id.style.display = 'block';
}
}
}
function close(id){
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'none';
}
else {
if (document.layers) { // Netscape 4
document.id.display = 'none';
}
else { // IE 4
document.all.id.style.display = 'none';
}
}
}
控制台中的任何错误?作为一个附注,您可以使用框架(JQuery,Prototype或MooTools)将open()和close()缩短为一行。 – 2010-01-17 01:57:07
不,没有错误。 好的。 – 2010-01-17 01:58:45