from: http://www.pczpg.com/html/bianchengkaifa/js/20091108/22559.html

 

1.下拉列表框选定值
  ddlPageSize.options[ddlPageSize.selectedIndex].value

取选中选项的文本

  ddlPageSize.options[ddlPageSize.selectedIndex].text

  ddlPageSize.options[ddlPageSize.selectedIndex].innerText

 

复选框
  $get('chkGoogle').checked

 

控件隐藏与显示:
  document.getElementById("控件名").style.display='' //显示, 或者block

  document.getElementById("控件名").style.display='none'

 

textBox:
   document.getElementById("控件名").value        //获取或设值文本框值
 

checkbox:
   document.getElementById('chkComJoin').checked //判断是否已选择
 
   example:
    if(document.getElementById('chkComJoin').checked)
            document.getElementById('trcomjoin').style.display=''
       
label:
   document.getElementById("控件名").innerHTML   //获取或设值标签值


网址验证:
   var urlreg1=/^[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/
                if (!urlreg1.test(a.value))//验证网址
                {
                    document.getElementById("lblCheckWebFormat2").innerHTML="请正确录入企业网址!";
                } else {
                     document.getElementById("lblCheckWebFormat2").innerHTML="";
                }

 

防止返回字符为类型 :
   if(typeof(返回值变量)!="undefined")

 

table添加行:  

  insertRow()
  insertCell()
        表ID.rows(0).cells(0).innerText   或   innerHTML //获取或设值某单元格

      var curRow=document.getElementById(表ID).rows.count;//得到表的最大行数,作为插入位置(第几行)
      var x=document.getElementById(name).insertRow(curRow); //插入一行在curRow位置,并定义x行对象
      var C1=x.insertCell(0);//插入一个单元格(列)在0位置,并定义C1列对象
      var C2=x.insertCell(1);
      var C3=x.insertCell(2);
      var C4=x.insertCell(3);
      var C5=x.insertCell(4);
      C1.innerHTML=ary[0];//为单元格赋值,
      C1.style.display='none';
      C2.innerHTML=ary[1];
      C2.style.display='none';
      C3.innerHTML='<a href=\"'+ary[0]+'\" target=\"_blank\">'+ary[2]+'</a>';
      C4.innerHTML=ary[3];
      C4.style.display='none';
      C5.innerHTML="<input type=\"button\" value=\"删除\"
      onclick=\"if(confirm('确实要删除当前项吗?')){DelteFile     ('"+ary[0]+';'+aryof1+"');this.parentNode.parentNode.removeNode(true)}\">";


日期控件使用:
   将日期控件放入弹出的新页面中,"<base target="_self"></base>"加入<HEAD></HEAD>之间
    <script>
    //返回值
    function getValue(Value) {
           window.returnValue=Value;
           window.close();
    }
    </script>


相关文章:

  • 2022-02-22
  • 2022-02-24
  • 2022-12-23
  • 2021-08-03
  • 2021-07-24
  • 2021-07-13
  • 2021-08-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2023-04-06
  • 2021-09-08
  • 2022-12-23
相关资源
相似解决方案