HTML按钮:document.getElementById("Button").click();
A4J按钮:document.getElementById("a4jButton").onclick();
JS操作HTML中的<select>标签:
获取值:document.getElementById("form1:goods_category").value;
获取文本:document.getElementById("form1:goods_category").text;
新增OPTION:
document.getElementById("formdata:ListBoxPersonSelected").options[document.getElementById("formdata:ListBoxPersonSelected").options.length]
= new Option(textlist,valuelist,true,true);
例子:
for(var i =0;i <document.getElementById("formdata:ListBoxPerson").options.length;i++)
{
if(document.getElementById("formdata:ListBoxPerson").options[i].selected)
{
valuelist = document.getElementById("formdata:ListBoxPerson").options[i].value;
textlist = document.getElementById("formdata:ListBoxPerson").options[i].text;
if(document.getElementById("formdata:ListBoxPersonSelected").options.length == 0)
{
document.getElementById("formdata:ListBoxPersonSelected").options[document.getElementById("formdata:ListBoxPersonSelected").options.length]
= new Option(textlist,valuelist,true,true);
}
else
{
for(var j =0;j <document.getElementById("formdata:ListBoxPersonSelected").options.length;j++)
{
if(valuelist == document.getElementById("formdata:ListBoxPersonSelected").options[j].value)
{
flg = true;
}
}
if(flg == false)
{
document.getElementById("formdata:ListBoxPersonSelected").options[document.getElementById("formdata:ListBoxPersonSelected").options.length]
= new Option(textlist,valuelist,true,true);
}else{flg = false;}
}
}
}