checkbox在html中的三种状态 未选中,选中和默认

<html>
<head>
<title>check在asp.net中的三种状态 未选中,选中和默认</title>
<script language="JavaScript">
<!--
/*
    check在asp.net中的三种状态 未选中,选中和默认
    作者:房客
    网址:http://sxlfybb.cnblogs.com
*/

function change(obj)
{
    
if(obj==null)
    
{
        obj 
= document.getElementById("che");
    }

    
if(String(obj.style.backgroundColor) == String("#dddddd"))
    
{
        obj.value
="";
        obj.style.backgroundColor
="";
        
return;
    }

    
if(obj.value=="")
    
{
        obj.value
="";
    }

    
else if(obj.value=="")
    
{
        obj.style.backgroundColor
="#dddddd";
    }

}

//-->
</script>
</head>
<style>
    #in input
    
{
        width
:15px;height:15px;padding-left:-20px;font-size:75%;cursor:hand;background-color:"#ffffff";
    
}

    body 
{ azimuth: 75grad } 

</style>
<body>

<div id="in">
<input type="text" id="che" onselectstart="event.returnValue=false;" ondragstart="event.returnValue=false;" readonly  onclick="change(this)"><onclick=change()>点击我</a>
</div>

</body>
</html>
原文地址:https://www.cnblogs.com/sxlfybb/p/719425.html