1、获得select选中的文本 或 value onchange 事件

function czSelect(dom,vt){
  if(vt==="text"){
  return txt=dom.options[dom.options.selectedIndex].text;
  }if(vt==="value"){
  return txt=dom.options[dom.options.selectedIndex].value;
  }
}
2、checkbox选中个数
function czCheckbox(dom){
  var checked_counts = 0;
  for(var i=0;i<dom.length;i++){
  if(dom[i].checked) {
  checked_counts++;
   }
  }
  return checked_counts;
}
3、获得radio的文本或value
function czRadio(dom,vt){
  for(var i=0;i<dom.length;i++){
  if(dom[i].checked){
  if(vt==="text"){
  return dom[i].text;
  }if(vt==="value"){
  return dom[i].value;
    }
  }
  }
}

4、超链接点击后不被带到目标窗口

      <a href="http://www.baidu.com" title="百度" onclick="helloWord();return false;">百度</a>

      return false:表示onclick事件处理函数认为这个链接没被点击

相关文章:

  • 2021-11-24
  • 2021-09-25
  • 2021-06-04
猜你喜欢
  • 2021-09-25
  • 2021-09-16
  • 2021-10-12
  • 2021-10-30
相关资源
相似解决方案