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>
    

      

  • 相关阅读:
    POJ1006(中国剩余定理)
    Ubuntu16.04安装jupiter
    OpenGL.tutorial06键盘和鼠标
    OpenGL.教程
    OpenGL.Qt532.cube
    Qt551.主窗体Margin
    Qt551.窗口滚动条
    Qt551.OpenGL.ZC简单例子
    Qt5OpenGL.顶点像素大小设置
    OpenGL.Tutorial03_Matrices_测试
  • 原文地址:https://www.cnblogs.com/GUOZHENY/p/6085955.html
Copyright © 2011-2022 走看看