大鱼

JSF中隐藏A4J按钮和普通按钮的JS单击事件

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;}
         }
     }
   }

posted on 2009-10-25 23:45 大鱼 阅读(1384) 评论(2)  编辑  收藏 所属分类: richfaces

评论

# re: JSF中隐藏A4J按钮和普通按钮的JS单击事件 2013-07-18 18:02 12

....  回复  更多评论   

# re: JSF中隐藏A4J按钮和普通按钮的JS单击事件 2013-07-18 18:02 12

lll  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: