Js:
Copy codeThe Code is as follows: function Save () // Save a value that is not a server control.
{
Var 1 = document. getElementById ('1box'). value;
Var 2 = document. getElementById ('2box'). value;
Var TxtValue = 1 + "■" + 2;
Document. getElementById ('3). value = TxtValue;
Return true;
}
Window. onload = function show ()
{
Var TxtValue = document. getElementById ('3). value;
If (TxtValue! = ""){
EachValue = new Array ();
EachValue = TxtValue. split ('■ ');
Document. getElementById ('1box'). value = EachValue [0];
Document. getElementById ('2box'). value = EachValue [1];
}
Return true;
}
Html:Copy codeThe Code is as follows: <input type = "text" id = "1 Box" class = "txt-underline" style = "width: 60px; text-align: left "maxlength =" 10 "/>
<Input type = "text" id = "2 Box" class = "txt-underline" style = "width: 200px; text-align: left" maxlength = "30"/>
<Input type = "hidden" id = "3" name = "Values" runat = "server"/>
CS:Copy codeCode: void LoadData () // page loading
{
BtnSave. Attributes. Add ("onclick", "javascript: Save ();");
String [] strTxtValues = new string [2];
StrTxtValues [0] = dr ["1"]. ToString ();
StrTxtValues [1] = dr ["2"]. ToString ();
String strValues = strTxtValues [0];
For (int I = 1; I <strTxtValues. Length; I ++)
{
StrValues + = "■" + strTxtValues [I];
}
This.3.Value = strValues;
}
Private void SaveOrUpdate () // save and modify
{
String [] strTxtValues = this.3.Value. Split ('■ ');
String 1 = strTxtValues [0];
String 2 = strTxtValues [1];