使用文本框将一个选项卡值添加到另一个选项卡。(one tab value to another tab both using text box.)

   IT问题网   2020-06-29 00:00:00

问 题

如果使用文本框和选项卡都使用java脚本在同一页面上,如何将一个选项卡值分配给另一个选项卡。

解决方案

您好,



我们可以在javascript中设置和获取输入值



标签在渲染后只是p标签,所以它是可能的



例如。



页面有两个标签,如..addcategory,showcategory



然后,如果你检查查看源,两个标签中的控件id都是......



"addcategory_textbox1_0_1"和showcategory_textbox2_0_1



在javascript中我们编写此代码,用于在一个文本框中将值分配到另一个文本框中



  document  .getelementbyid("  addcategory_textbox1_0_1" )。value =  document  .getelementbyid("  showcategory_textbox2_0_1")。价值; 






  document  .getelementbyid(" lt;%= textbox1.clientid%gt;")。value =  document  .getelementbyid( " lt;%= textbox2.clientid%gt;")。值


这里我们可以动态地将id传递给这个方法。



来自服务器端。



如果你指定你的代码我可以解释更多。

我希望你理解我所说的。



这里我''添加此代码



 lt;   html     xmlns   ="   http://www.w3.org/1999/xhtml" gt;  
lt; head runat =" 服务器" gt ;
lt; title gt; lt; / title gt;
lt; script src =" scripts / jquery-1.4。 1-vsdoc.js" type =" text / javascript" gt; lt; / script gt ;
lt; script src =" scripts / jquery-1.4 .1.js" type =" text / javascript" gt; lt; / script gt;
lt; script language =" javascript" gt;
function checkb(){

" #lt;%= textbox1.clientid%gt;")。val(

" #lt;%= textbox2.clientid%gt;")。val());
}
lt; / 脚本 gt;
lt; / head gt;
lt; body gt;
lt; 表单 id =" form1" runat =" server" gt;
lt; p gt;
lt; asp:textbox id =" textbox1" runat =" 服务器" gt;
lt; asp:textbox id =" textbox2" runat =" 服务器" gt;
lt; 输入 id =" btncheck" type =" 按钮" value =" 检查" onclick =" checkb()" / gt;
lt; / p gt;
lt; / form gt;
lt; / body gt;
lt; / html gt;



所有最佳

标签:使用文本框一个选项添加另一个



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

使用WSAsy-Model的Win32套接字(Win32 Socket using WSAsy-Model)

problem hi !i want to use the wsaasyncselect ...

一次单击添加空白记录(one click add blank record)

problem dear sir, when was clicking edit link button ther ...

关于sql'列表的问题(the problem which is about listing of sql')

problem i want to get 3 datas which has been added lastly ...

DataGridView绑定源datacontext.ExecuteQuery allowusertoaddrows已禁用(DataGridView Binding Source datacontext.ExecuteQuery allowusertoaddrows disabled)

problem using the following code: iqueryable data = db.e ...

我想在每个页面上显示用户名(I want to display username on every page)

problem can i use loginview control without login control ...

解释如何重载.ToString()方法......(Explain how to overload .ToString() method...)

problem help me friends... :) thanks in advance... soluti ...

UserControl编辑对象(UserControl to edit an object)

problem hello, i have a usercontrol that has some fields ...

使用任何网络服务获取英国的邮政编码和地址(get postal code and address of UK using any web service)

problem hi, i have 2 text box. 1 for u.k. p ...

Windows 7的应用程序(application for windows 7)

problem do i need to install anything to program an app u ...

将控件添加到datagridview(add control to datagridview)

problem hi, there is a control called nbtext (which forma ...

多列和网格下拉列表(无自动完成)(dropdown with multicolumn and grid(no autocomplete))

problem i need a dropdown with multicolumn like the follo ...

如何创建oracle数据库DSN?(how to create oracle database DSN)

problem respected sir/mam i have a oracle database in my ...

获取dataTable中字符串的长度(get length of a string in dataTable)

problem hiii all i make a for loop on datatab ...

使用大型数据库(working with large databases)

problem hi, we use sql server 2008 database ...

数据列表中的CountDown计时器(CountDown timers in a datalist)

problem im developing a auction website where students fr ...

插入记录器的问题(problem in inserting recorod)

problem cmd = new sqlcommand("insert into login1 values" ...

显示行到列(Display Row to Column)

problem how row to column value display in crystal report ...

Gridview中的复选框(Check box in Gridview)

problem if i check checkbox in gridview after that if i c ...

更新DatagridView记录(Updating DatagridView Records)

problem what am i doing wrong i can seem to u ...

如何从tortoiseSVN获取最新版本,然后使用CruiseControl.NET在msbuild中构建它(how to get latest version from tortoiseSVN and then build it in msbuild with CruiseControl.NET)

problem hi, i had a one asp.net solution in ...