JS选中下拉框值付给textarea

方法1:
function setValues(){

var se =document.getElementById(“CategoryOneID”);
var option=se.getElementsByTagName(“option”);
var str = “” ;
for(var i=0;i<option.length;++i)
{
   if(option[i].selected)
    {
      var ujk = option[i].text;
    }
}
var se1 =document.getElementById(“CategoryTwoID”);
var option1=se1.getElementsByTagName(“option”);
var str1 = “” ;
for(var i1=0;i1<option1.length;++i1)
{
   if(option1[i1].selected)
    {
      var ujk1 = option1[i1].text;
    }
}
var op=”(“;
var opl=”)”;
 document.getElementById(“txt2”).value=document.getElementById(“txt2″).value+ujk1+op+ujk+opl+”\r\n”;
方法2:
var oTextbox1=document.getElementById(“CategoryOneID”);
var oTextbox2=document.getElementById(“CategoryTwoID”);
var oTextbox3=document.getElementById(“txt3”);
oTextbox2.value=oTextbox2.value+oTextbox1.value+oTextbox3.value;
document.getElementById(“txt4”).value=document.getElementById(“txt4”).value+oTextbox1.value+oTextbox3.value;
document.getElementById(“txt5”).value=document.getElementById(“txt5”).value+oTextbox2.value+oTextbox3.v

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注