复选框选中多个选项后要在文本框里显示内容
\u5341\u4e94.\u4ec0\u4e48\u53eb\u5355\u9009\u9879?\u4ec0\u4e48\u53eb\u590d\u9009\u6846?\u4ec0\u4e48\u53eb\u6587\u672c\u6846?\u4ec0\u4e48\u53eb\u5355\u9009\u9879?
\u5355\u9009\u9879\u662f\u4e2a\u7a7a\u5fc3\u5706\uff0c\u9009\u4e2d\u540e\u4e2d\u95f4\u4f1a\u51fa\u73b0\u4e00\u4e2a\u9ed1\u8272\u5706\u70b9\uff0c\u4e00\u4e2a\u9009\u62e9\u91cc\u9762\u53ea\u80fd\u540c\u65f6\u9009\u4e2d\u4e00\u4e2a\u5355\u9009\u9879\u3002
\u4ec0\u4e48\u53eb\u590d\u9009\u6846?
\u590d\u9009\u6846\u662f\u7a7a\u5fc3\u65b9\u6846\uff0c\u9009\u4e2d\u540e\u4e2d\u95f4\u4f1a\u51fa\u73b0\u5bf9\u53f7\uff0c\u4e00\u4e2a\u9009\u62e9\u91cc\u9762\u53ef\u4ee5\u540c\u65f6\u9009\u4e2d\u591a\u4e2a\u3002
\u4ec0\u4e48\u53eb\u6587\u672c\u6846?
\u6587\u672c\u6846\u5c31\u662f\u53ef\u4ee5\u5411\u5176\u4e2d\u8f93\u5165\u6587\u5b57\u7684\u6846\uff0c\u6bd4\u5982\u767e\u5ea6www.baidu.com\u4e2d\u95f4\u90a3\u4e2a\u6846\u3002
\u524d\u53f0\uff1a
<asp:CheckBox ID="CheckBox1" Text="2" AutoPostBack="true" runat="server"
oncheckedchanged="CheckBox1_CheckedChanged" />
<asp:CheckBox ID="CheckBox2" Text="3" AutoPostBack="true" runat="server"
oncheckedchanged="CheckBox2_CheckedChanged" />
\u540e\u53f0\uff1a
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
SetTextbox();
}
protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
SetTextbox();
}
private void SetTextbox()
{
int re = 0;
if (CheckBox1.Checked)
{
re += Convert.ToInt32(CheckBox1.Text);
}
if (CheckBox2.Checked)
{
re += Convert.ToInt32(CheckBox2.Text);
}
TextBox1.Text = re + "";
}
绛旓細1銆佹墦寮VB杞欢锛屽湪绐椾綋涓婇潰娣诲姞涓涓枃鏈銆2銆佺偣鍑绘枃鏈锛屽湪鍙充晶鐨勫睘鎬х獥鍙d腑锛岃缃悕绉板拰鏁板硷紝灏嗘枃鏈唴瀹规竻绌恒3銆佸湪绐椾綋涓婇潰锛屽啀娣诲姞涓涓按骞虫粴鍔ㄦ潯銆4銆佺偣鍑绘按骞虫粴鍔ㄦ潯锛岃缃悕绉板拰鏁板硷紝灏哅in璁剧疆涓0,Max璁剧疆涓100銆傦紙鏂囨湰妗嗕腑鐨勮緭鍏ョ殑鏁拌寖鍥翠负0-100锛夈傚皢largechange璁剧疆涓5锛孲mallchange璁剧疆涓...
绛旓細Private Sub Command1_Click()\'command1.caption=\"纭畾\"Text1.Text = \"\"For i = 0 To 4 If Check1(i).Value = Checked Then Text1.SelText = Check1(i).Caption & \"(\" & i & \")\" & \"琚変腑\" & vbCrLf Else Text1.SelText = Check1(i).Caption & \"(\" ...
绛旓細杩欎釜搴旇闇瑕 JS 鏉ュ疄鐜板惂锛屾湁鐐圭被浼肩紪杈戝櫒鍔熻兘鐨勫疄鐜 鍒嗗埆閫氳繃JS 鍙栧緱 澶嶉夋 鍜 鏂囨湰妗鐨 value锛屽綋閫夋嫨澶嶉夋鏃讹紝鏂囨湰妗嗙殑 value 鍊间负 鏂囨湰妗.value += 澶嶉夋.value;杩欐牱搴旇鍙互瀹炵幇锛屼絾濡傛灉鍐嶆鐐瑰嚮锛屽苟鍒犻櫎瀵瑰簲鐨勫硷紝鎴戝氨涓嶆竻妤氫簡 ...
绛旓細If Check1(i).Value = 1 Then Text1.Text = Text1.Text & Check1(i).Caption & vbCrLf Next End Sub
绛旓細鏃犳爣棰樻枃妗
绛旓細function checkbox() { var str = document.getElementsByName("box");var objarray = str.length;var chestr;var chestrName;for (i = 0; i < objarray; i++) { if (str[i].checked == true){ chestr += str[i].value + ",";if (str[i].id != null) { chestrName += ...
绛旓細浣跨敤鈥滅獥浣撯濆伐鍏蜂腑鐨勭瓫閫夋锛屽彧鑳戒娇A2鍗曞厓鏍兼樉绀轰负鈥淭RUE鈥濇垨鈥淔ALSE鈥濅娇鐢ㄢ滄帶浠跺伐鍏风鈥濆伐鍏蜂腑鐨澶嶉夋锛屽弻鍑昏繖涓瓫閫夋锛屽啀璁剧疆涓涓唬鐮佸氨鍙互瀹炵幇鎺у埗鏁板间簡 Private Sub CheckBox1_Change()If CheckBox1.Value = True Then [a2] = 5 Else [a2] = 1 End If End Sub ...
绛旓細Click()If Option1.Value = True Then Text1.Text = Option1.CaptionEnd IfEnd SubPrivate Sub Option2_Click()If Option2.Value = True Then Text1.Text = Option2.CaptionEnd IfEnd Sub5銆佽繍琛屽伐绋嬶紝閫変腑鍗曢夋鎴栬澶嶉夋锛屽彲浠ュ湪Text鏂囨湰妗涓湅鍒板崟閫夋鎴栬呮槸澶嶉夋鐨勫悕绉般
绛旓細涓婇潰鏄夋嫨鐨勬儏鍐 涓婇潰鏄竻闄ゅ悗鐨勬儏鍐 Private Sub Check1_Click(Index As Integer) '娉ㄦ剰锛氳繖鏄暟缁勬帶浠禗im SS As IntegerSS = Check1(Index).IndexIf Check1(SS).Value = 1 ThenText1.Text = Text1.Text & ", " & Check1(SS).Caption'濡傛灉杩欓噷涓嶈緭鍏ユ帶浠舵爣棰橈紝鍙互灏嗚緭鍏ョ殑鍐呭鎻愬墠瀛...
绛旓細澶氫釜澶嶉 input{ margin-right:3px} label{margin:0 5px} window.onload = function(){ var obox = document.getElementById("box");var cboList = obox.getElementsByTagName("input");var oText = document.getElementById("tt");document.getElementById("count").onclick = function...