黑松山资源网 Design By www.paidiu.com
复制代码 代码如下:
/*
描述:        CHECKBOX控件
版本:        1.1
备注:        CHECKBOX控件背后跟随的文字
            是获取CHECKBOX对象的htc_myLabel来显示的
            更新添加indeter属性,用来增加不确定的选择
*/
<public:component>
<public:attach event="oncontentready" onevent="fnInit()" />
<public:attach event="onpropertychange" onevent="fnPropertychange()" />
<script language="Javascript">
var checkBoxImg=window.document.createElement("IMG");
ImageArray=[];
ImageArray["checkbox_false"]="checkbox_false.gif";
ImageArray["checkbox_false_down"]="checkbox_false_down.gif";
ImageArray["checkbox_false_over"]="checkbox_false_over.gif";
ImageArray["checkbox_true"]="checkbox_true.gif";
ImageArray["checkbox_true_down"]="checkbox_true_down.gif";
ImageArray["checkbox_true_over"]="checkbox_true_over.gif";
ImageArray["checkbox_indeter"]="checkbox_indeter.gif";
ImageArray["checkbox_indeter_down"]="checkbox_indeter_down.gif";
ImageArray["checkbox_indeter_over"]="checkbox_indeter_over.gif";
function preLoad(path,obj){
    for(i in obj){
        this[i]=new Image();
        this[i].src=path+obj[i];
        }
    return this;
    }
preb=new preLoad("images/",ImageArray);
function fnInit(){
    var o=element;
    if(o.type=="checkbox"){
        var _table=window.document.createElement("TABLE");
        _table.cellSpacing="0px";
        _table.cellPadding="0px";
        _table.border="0px";
        if(o.disabled){
            _table.style.filter="alpha(Opacity=50)";
            }
        else{
            _table.style.filter="";
            }
        _table.style.display="inline";
        var _tr=_table.insertRow();
        var _td=_tr.insertCell();
        if (o.checked){
            checkBoxImg.src=preb["checkbox_true"].src;
            }
        else{
            checkBoxImg.src=preb["checkbox_false"].src;
            }
        if(o.indeter=="true"){
            o.indeterminate="true";
            checkBoxImg.src=preb["checkbox_indeter"].src;
            }
        _td.appendChild(checkBoxImg);
        _td=_tr.insertCell();
        _td.style.verticalAlign="bottom";
        if(o.htc_myLabel){
            _td.innerHTML="&nbsp<label style='cursor: hand'>"+o.htc_myLabel+"</label>";
            }
        o.insertAdjacentElement("afterEnd",_table);
        o.style.display="none";
        _table.attachEvent("onmouseover",function(){Baction("over")});
        _table.attachEvent("onmouseout",function(){Baction("out")});
        _table.attachEvent("onmousedown",function(){Baction("down")});
        _table.attachEvent("onmouseup",function(){Baction("up")});
        _table.attachEvent("onclick",function(){fnClick()});
        }
    }
function fnPropertychange(){
    var o=element;
    switch(event.propertyName.toString().toLowerCase()){
        case "checked":
            Baction("up");
            break;
        }
    }
function fnClick(){
    var o=element;
    if(o.type=="checkbox"){
        if(o.disabled)return;
        if(o.checked){
            checkBoxImg.src=preb["checkbox_false"].src;
            }
        else{
            checkBoxImg.src=preb["checkbox_true"].src;
            }

        o.checked=!o.checked;
        }
    }
function Baction(action){
    var o=element;
    if(o.type=="checkbox"){
        if(o.disabled)return;
        if(action=="up"||action=="over"){
            if(o.indeterminate){
                checkBoxImg.src=preb["checkbox_indeter_over"].src;
                }
            else if(o.checked){
                checkBoxImg.src=preb["checkbox_true_over"].src;
                }
            else{
                checkBoxImg.src=preb["checkbox_false_over"].src;
                }
            }
        if(action=="out"){
            if(o.indeterminate){
                checkBoxImg.src=preb["checkbox_indeter"].src;
                }
            else if(o.checked){
                checkBoxImg.src=preb["checkbox_true"].src;
                }
            else{
                checkBoxImg.src=preb["checkbox_false"].src;
                }

            }
        if(action=="down"){
            if(o.indeterminate){
                checkBoxImg.src=preb["checkbox_indeter_down"].src;
                }
            else if(o.checked){
                checkBoxImg.src=preb["checkbox_true_down"].src;
                }
            else{
                checkBoxImg.src=preb["checkbox_false_down"].src;
                }
            o.indeterminate=false;
            }
        }
    }
</script>
</public:component>

测试例子:
复制代码 代码如下:
<html>
<head>
<title> 新文档 </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="FlashSoft">
<meta name="Keywords" content="">
<meta name="Description" content="FlashSoft">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="Text/Css">

input.checkbox{
    behavior:url("behaviors/checkbox.htc");cursor: hand;
    }

</style>
</head>
<body>
<input name="chk1" type="checkbox" class="checkbox" htc_myLabel="音乐" checked>
<input name="chk1" type="checkbox" class="checkbox" htc_myLabel="体育" disabled>
<input name="chk1" type="checkbox" class="checkbox" htc_myLabel="新闻">
<input name="chk1" type="checkbox" class="checkbox" htc_myLabel="不确定属性1" indeter="true" checked>
<input name="chk1" type="checkbox" class="checkbox" htc_myLabel="不确定属性2" indeter="true" disabled>
<input name="chk1" type="checkbox" class="checkbox" htc_myLabel="不确定属性3" indeter="true">
</body>
</html>

用htc实现CHECKBOX控件 下载此文件
黑松山资源网 Design By www.paidiu.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
黑松山资源网 Design By www.paidiu.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。