一个选项卡值到另一个选项卡都使用文本框. [英] one tab value to another tab both using text box.

查看:78
本文介绍了一个选项卡值到另一个选项卡都使用文本框.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果同时使用文本框和使用Java脚本在同一页上的选项卡,则如何将一个选项卡的值分配给另一选项卡.

how to assign one tab value to another tab if both using text box and also tabs are on same page using java script.

推荐答案

您好,

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

渲染后,Tab只不过是div标签,所以有可能

例如
页面上有两个标签,例如:.AddCategory,ShowCategory

然后,如果您签入视图源,则两个选项卡中的控件ID就像...

"AddCategory_TextBox1_0_1"和ShowCategory_TextBox2_0_1

在javascript中,我们编写了这段代码,用于将一个文本框中的值分配给另一个文本

Hi,

we can set and get input values in javascript

Tab is nothing but div tags after rendering so it is possible

for eg.

page has two tabs like..AddCategory,ShowCategory

then if you check in view source the control id s in both tabs are like ...

"AddCategory_TextBox1_0_1" and ShowCategory_TextBox2_0_1

in javascript we write this code for assigning value in one textbox into another

document.getElementByID("AddCategory_TextBox1_0_1").Value=document.getElementByID("ShowCategory_TextBox2_0_1").Value;






or

document.getElementbyID("<%=TextBox1.ClientID%>").Value=document.getElementbyID("<%=TextBox2.ClientID%>").Value


在这里,我们可以将id动态传递给此方法.

从服务器端.

如果您指定代码,则可以进一步解释.
我希望你能理解我说的话.

我在这里添加此代码


Here we can pass ids to this method dynamically.

from server side.

if you specify your code I can explain more.
I hope you understood What I said.

Here i''m adding this code

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script language ="javascript" >
        function checkb() {


(" #<%= TextBox1.ClientID%>").val(


( #<%= TextBox2.ClientID%>").val()); } < / 脚本 > < /head > < 正文 > < 表单 =" form1" runat >服务器" > < div > < asp:TextBox ID =" runat 服务器" < asp:TextBox ID =" runat 服务器" < 输入 =" btncheck" 类型 =" 按钮" =" onclick =" / > < /div > < /form > < /body > < /html >
("#<%=TextBox2.ClientID %>").val()); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"> <asp:TextBox ID="TextBox2" runat="server"> <input id="btncheck" type ="button" value ="check" onclick ="checkb()" /> </div> </form> </body> </html>



最好的



All the Best


这篇关于一个选项卡值到另一个选项卡都使用文本框.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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