Javascript 取消(重置html)按钮不工作
我不熟悉html、javascript和css。 我不知道为什么,但我的取消按钮根本不起作用Javascript 取消(重置html)按钮不工作,javascript,html,css,Javascript,Html,Css,我不熟悉html、javascript和css。 我不知道为什么,但我的取消按钮根本不起作用 <!DOCTYPE html> <html> <head> <!-- set the page title and link with java script and css files --> <title></title> <meta http-equiv="Content-Type" content="text/htm
<!DOCTYPE html>
<html>
<head>
<!-- set the page title and link with java script and css files -->
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="hw4.css">
<script src="hw4.js"></script>
</head>
<body>
<section>
<table>
<tr>
<td class="first">Post to</td>
<!-- create two post to buttons -->
<td class="second"><input id="entire" type="radio" name="post"
value="entire" checked>Entire Class <input type="radio"
id="individual" name="post" value="individual">Individual
Student(s)/instructor(s)</td>
</tr>
<tr>
<td class="first">Select Folder(s)</td>
<td class="second">
<!-- create six homework checkboxes -->
<div class="hw">
<input id="hw1" type="checkbox"><label for="hw1">hw1</label>
<input id="hw2" type="checkbox"><label for="hw2">hw2</label>
<input id="hw3" type="checkbox"><label for="hw3">hw3</label>
<input id="hw4" type="checkbox"><label for="hw4">hw4</label>
<input id="hw5" type="checkbox"><label for="hw5">hw5</label>
<input id="hw6" type="checkbox"><label for="hw6">hw6</label>
</div>
</td>
</tr>
<tr>
<td class="first">Summary
<div style="font: 10px Arial">(100 charactors or less)</div>
</td>
<td class="second"><input id="summary" type="text" size="25"
value="Enter a one line summary...!" onclick="this.value='';"></td>
</tr>
<tr>
<td class="first">Details</td>
<!-- create detail text area. -->
<td class="second"><textarea id="details" name="textarea"
rows="10" cols="50" wrap='off'></textarea></td>
</tr>
<tr>
<td class="first">Posting Options</td>
<!-- create two option check boxes -->
<td><input id="option1" type="checkbox"> Make this an
announcement (note appears on the course page)</br> <input id="option2"
type="checkbox"> Send email notifications immediately
(bypassing student's email preferences, if neccesory)</td>
</tr>
<tr>
<td></td>
<td>
<input id="post" type="submit" value="Post My Note!" onClick="check()">
<input id="cancel" type="reset" value="Cancel" />
</td>
</table>
</section>
</body>
</html>
寄往
全班个人
学生/教员
选择文件夹
hw1
hw2
hw3
hw4
hw5
hw6
总结
(100个字符或更少)
细节
过帐选项
让这成为一个
公告(备注显示在课程页面上)立即发送电子邮件通知
(如有必要,绕过学生的电子邮件首选项)
当我运行这段代码时,一切正常,但是取消按钮不起作用。
我想我做错了什么,因为它就像30分钟前一样工作,但是
现在它根本不起作用了,我也不知道是什么错了 您没有
表单
标签。重置按钮可清除窗体内的值
2种解决方案:
- 将输入元素包装在
- 编写一段脚本,在单击“清除”按钮时清除要清除的元素
- 您没有
表单
标签。重置按钮可清除窗体内的值
2种解决方案:
- 将输入元素包装在
- 编写一段脚本,在单击“清除”按钮时清除要清除的元素
寄往
全班个人
学生/教员
选择文件夹
hw1
hw2
hw3
hw4
hw5
hw6
总结
(100个字符或更少)
细节
过帐选项
让这成为一个
公告(备注显示在课程页面上)立即发送电子邮件通知
(如有必要,绕过学生的电子邮件首选项)
试试这个:
重置按钮仅适用于表单标签。所以,请在您的代码中添加表单标记,如我在演示中所示
寄往
全班个人
学生/教员
选择文件夹
hw1
hw2
hw3
hw4
hw5
hw6
总结
(100个字符或更少)
细节
过帐选项
让这成为一个
公告(备注显示在课程页面上)立即发送电子邮件通知
(如有必要,绕过学生的电子邮件首选项)
其中是表单标签。重置按钮只清除formMy first Think将延迟属性添加到脚本标记中,它将在页面加载后执行js。但是如果没有js,就很难找到问题的根源。请做一把小提琴,就像艾米问的:)作为旁白,重置按钮是魔鬼造的。表单标签在哪里。重置按钮只清除formMy first Think将延迟属性添加到脚本标记中,它将在页面加载后执行js。但是如果没有js,就很难找到问题的根源。请做一把小提琴,正如艾米问的:)作为旁白,重置按钮来自魔鬼。@provost你可以看到谁先回答的评论:)谢谢,公平地说,艾米和我相隔几秒钟。编辑就像现在在这个评论:)@TheProvost你也可以看到谁先回答的评论:)谢谢,公平地说,艾米和我相隔几秒钟。就像现在在这个注释中一样编辑:)虽然缺少form
元素确实是原因,但不应该使用无效的HTML来修复这个问题。表单
元素不允许作为表
的子元素;虽然缺少form
元素确实是原因,但不应该使用无效的HTML来解决这个问题。表单
元素不允许作为表
的子元素;它们可以以另一种方式嵌套。