html表单相关问题

发布于 2024-11-06 00:54:52 字数 2536 浏览 0 评论 0原文

嘿,我想重置表格,但我不知道怎么做。我的意思是我应该在哪里添加事件。我希望在提交表单后或在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

四叶草在未来唯美盛开 2024-11-13 00:54:52

误读了你的问题...

你需要使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文