html表单相关问题
嘿,我想重置表格,但我不知道怎么做。我的意思是我应该在哪里添加事件。我希望在提交表单后或在 iframe 中加载结果之前重置该表单。
<div class="mainArea">
<iframe id="uploadTarget" name="uploadTarget" src="OnlineExam?q=allQuestions"
style="width:15%;height:100%;border:1px solid #fff; float:left;" >
</iframe>
<div id="questionArea">
<h1 class="headingClassC">Please Input Questions: </h1>
<br class="clearFormatting"/>
<span class="instructions"><br/>
1. You can use HTML tags to format your text
<br/>
2. To Edit a previously inserted question please click on the question no. shown on the left side.<br/>
3. You can attach an image file with the question which will be used as reference. <br/>
</span>
<form action="OnlineExam?q=saveQuestion" method="post" target="uploadTarget" id="inputQuestionForm">
<fieldset>
<legend>Question</legend>
<textarea class="questionArea" id="question" name="question">Enter Question.</textarea>
<br class="clearFormatting"/>
<input class="optionsInput" value="optionA" name="optionA" onfocus = "clearValues('optionA')" onblur = "setValues('optionA')"/>
<br class="clearFormatting"/>
<input class="optionsInput" value="optionB" name="optionB" onfocus = "clearValues('optionB')" onblur = "setValues('optionB')"/>
<br class="clearFormatting"/>
<input class="optionsInput" value="optionC" name="optionC" onfocus = "clearValues('optionC')" onblur = "setValues('optionC')"/>
<br class="clearFormatting"/>
<input class="optionsInput" value="optionD" name="optionD" onfocus = "clearValues('optionD')" onblur = "setValues('optionD')"/>
<br/>
<input class="optionsInput" value="answer" name="answer" onfocus="clearValues('answer')" onblur="setValues('answer')"/>
<input type="submit" value="Save"/>
<input type="reset" value="Cancel" />
<button style="display: none" onclick="return deleteQuestion()" >Delete</button>
</fieldset>
</form>
<br/><br/>
Once you have finished inputing question <a href="OnlineExam?q=ready">click here</a> to go back.
</div>
</div>
Hey I want to reset the form but i don't know how. i mean where should i add event. I want that form should be reset just after i submit the form or before the result is loaded in iframe.
<div class="mainArea">
<iframe id="uploadTarget" name="uploadTarget" src="OnlineExam?q=allQuestions"
style="width:15%;height:100%;border:1px solid #fff; float:left;" >
</iframe>
<div id="questionArea">
<h1 class="headingClassC">Please Input Questions: </h1>
<br class="clearFormatting"/>
<span class="instructions"><br/>
1. You can use HTML tags to format your text
<br/>
2. To Edit a previously inserted question please click on the question no. shown on the left side.<br/>
3. You can attach an image file with the question which will be used as reference. <br/>
</span>
<form action="OnlineExam?q=saveQuestion" method="post" target="uploadTarget" id="inputQuestionForm">
<fieldset>
<legend>Question</legend>
<textarea class="questionArea" id="question" name="question">Enter Question.</textarea>
<br class="clearFormatting"/>
<input class="optionsInput" value="optionA" name="optionA" onfocus = "clearValues('optionA')" onblur = "setValues('optionA')"/>
<br class="clearFormatting"/>
<input class="optionsInput" value="optionB" name="optionB" onfocus = "clearValues('optionB')" onblur = "setValues('optionB')"/>
<br class="clearFormatting"/>
<input class="optionsInput" value="optionC" name="optionC" onfocus = "clearValues('optionC')" onblur = "setValues('optionC')"/>
<br class="clearFormatting"/>
<input class="optionsInput" value="optionD" name="optionD" onfocus = "clearValues('optionD')" onblur = "setValues('optionD')"/>
<br/>
<input class="optionsInput" value="answer" name="answer" onfocus="clearValues('answer')" onblur="setValues('answer')"/>
<input type="submit" value="Save"/>
<input type="reset" value="Cancel" />
<button style="display: none" onclick="return deleteQuestion()" >Delete</button>
</fieldset>
</form>
<br/><br/>
Once you have finished inputing question <a href="OnlineExam?q=ready">click here</a> to go back.
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
误读了你的问题...
你需要使用 javascript 来重置表单。
这是一个很好的开始:
使用 jQuery 重置多阶段表单
您应该在 iframe 中添加一个脚本来调用父框架并在 iframe 加载后清除表单。
您显然无法在提交事件之前清除表单。
misread your question...
You need to use javascript to reset the form.
Here is a good start for doing that:
Resetting a multi-stage form with jQuery
you should add a script in your iframe to call into the parent frame and clear the form once the iframe loads.
You obviously cant clear the form before the submit event.