zoukankan      html  css  js  c++  java
  • HTML <button>标签

    如果<button>标签在<form>中不加type=“button”,那么默认含义是“submit”。

    <button>标签里面disabled属性使其不可用,常见javascript修改disabled属性实例:(a键b键互相撕逼)

    <style>
      #a,#b
      {
      height:30px;
      70px;
      background:yellow;
      box-sizing:border-box;
      }
    
      
      
      
      </style>
     </head>
     <body>
     <button type="button" id="a" onclick="an()" >会变色</button>
     <button type="button" id="b" onclick="bn()" >会变色</button>
    	<script>
    
    	function bn()
    	{
    
    		if(document.getElementById("b").disabled!="true")
    
    		{
    			document.getElementById("b").disabled="true";
    			document.getElementById("b").style.background="gray";
    			document.getElementById("a").removeAttribute("disabled");
    			document.getElementById("a").removeAttribute("style");
    		}
    		else
    		{
    			document.getElementById("a").disabled="true";
    			document.getElementById("a").style.background="gray";
    			document.getElementById("b").removeAttribute("disabled");
    			document.getElementById("b").removeAttribute("style");
    		}
    
    	}
    	function an()
    
    	{
    
    		if(document.getElementById("a").disabled!="true")
    		{
    			document.getElementById("a").disabled="true";
    			document.getElementById("a").style.background="gray";
    			document.getElementById("b").removeAttribute("disabled");
    			document.getElementById("b").removeAttribute("style");
    		}
    		else
    		{
    			document.getElementById("b").disabled="true";
    			document.getElementById("b").style.background="gray";
    			document.getElementById("a").removeAttribute("disabled");
    			document.getElementById("a").removeAttribute("style");
    		}
    	}
    	</script>
    </body>
    

      

  • 相关阅读:
    Codeforce Round #215 Div2 C
    Facebook Hacker Cup 2014 Qualification Round
    Codeforce Round #214 Div2
    Codeforce Round #213 Div2
    FOJ 2013 11 月赛
    Codeforce Round #211 Div2
    Codeforce Round #210 Div2
    如何下载spring-framework
    [转]大型网站系统架构的演化
    sql查询,如何增加一列
  • 原文地址:https://www.cnblogs.com/GUOZHENY/p/6085955.html
Copyright © 2011-2022 走看看