单击一下按钮即可刷新多个文本框 [英] Refresh multiple textbox at a single button click

查看:58
本文介绍了单击一下按钮即可刷新多个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好吧



我有一个带有一些文本框的网页和一个名称刷新的按钮,当我点击按钮时所有的文本框都应该刷新,怎么能你实现了这个吗?



在按钮事件中我们可以写textbox1.text =或text.clear();





如果我的网页表格中有25个控件,那么对于25个控件你会写文本。 text =------等等。





谢谢你

解决方案

你可以用javascript来重置形式:



  document  .getElementById('  form1')。reset(); 

点击按钮。



其中'form1'是表单id。


由于这是一个网页,清除所有操作不应该一直往返服务器和后面。一个简单的jQuery就足够了,例如

 <   head     runat   = < span class =code-keyword> server >  
< title > < / title >
< script src = http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js > < / script >
< script >


(document).ready(function(){

Hi all

I have a webpage with some text boxes and one button with name refresh, when I click the button all the textboxes should get refresh, how can u achieve this?

In button event we can write the textbox1.text="" or text.clear();


Side question if I have 25 control in my webform then for 25 controls you will write text. text="" ------ so on.


Thank you

解决方案

you can use javascript to reset the form:

document.getElementById('form1').reset();

on button click.

where 'form1' is the form id.


Since this is web page, a clear all operation should not have to incur a round trip all the way to the server and back. A simple jQuery will suffice, e.g.

<head runat="server">
    <title></title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>


(document).ready(function () {


这篇关于单击一下按钮即可刷新多个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆