scbutton.htc

来自「龍族 伺服器 管理 系統 管理網路遊戲(龍族)的asp網頁」· HTC 代码 · 共 230 行

HTC
230
字号
<HTC URN="scButton">

	<ATTACH EVENT="ondocumentready" HANDLER="fnInit"      />	
	<ATTACH EVENT="onmouseover"     HANDLER="fnMouseOver" />
	<ATTACH EVENT="onmouseout"      HANDLER="fnMouseOut"  />
	<ATTACH EVENT="onmousedown"     HANDLER="fnMouseDown" />
	<ATTACH EVENT="onselectstart"   HANDLER="fnSelect"    />
	<ATTACH EVENT="onmouseup"       HANDLER="fnMouseUp"   />
	
	<PROPERTY NAME="href"       />
	<PROPERTY NAME="target"     />
	<PROPERTY NAME="type"       />		
	<PROPERTY NAME="isEnabled"  />
	
	
<script LANGUAGE="jscript">

/// sets style to normal button
function fnStyleSetNormal()
{	
	element.style.cursor			= "Default";
	element.style.font				= "Icon";
	element.style.fontWeight		= "normal";
	element.style.border			= "0px solid Buttonshadow";
	element.style.whiteSpace		= "nowrap";
	element.style.verticalAlign		= "middle";
	element.style.backgroundColor	= "ButtonFace";	
	element.style.filter			= ""
	
	if(type == null || type == 0)
	{		
		element.style.padding			= "3px";
	}
	else if(type != null && type == 1)
	{		
		element.style.padding			= "4px";
		
	}
	
}

/// sets style to raised button
function fnStyleSetUp()
{
	if(type != null && type == 1)
	{		
		element.style.borderWidth		= "1px";
		element.style.border			= "1px solid #0A246A"
		element.style.padding			= "3px";			
		element.style.background		= "#B6BDD2";
		
		for(i=0;i<element.children.length;i++)
		{
			element.children[i].style.filter = "progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2,Color='#888D9D', Positive='true')" 	
		}
		
	}
	else
	{
		element.style.borderWidth		= "1px";
		element.style.borderLeftColor	= "ButtonHighlight";
		element.style.borderRightColor	= "ButtonShadow";
		element.style.borderTopColor	= "ButtonHighlight";
		element.style.borderBottomColor	= "ButtonShadow";
		element.style.padding			= "2px";	
		element.style.filter			= ""
	}
}

/// sets style to pressed button
function fnStyleDown()
{
	
	if(type != null && type == 1)
	{
		element.style.padding			= "3px";	
		element.style.border			= "1px solid #0A246A"
		element.style.background		= "#8592B5";
	}
	else
	{
		element.style.borderLeftColor	= "ButtonShadow";
		element.style.borderRightColor	= "ButtonHighlight";
		element.style.borderTopColor	= "ButtonShadow";
		element.style.borderBottomColor	= "ButtonHighlight";
		element.style.borderWidth		= "1px";
		element.style.padding		= "3px";	
	}
		
	element.style.filter			= ""		
}

/// sets style to disabled button
function fnSetDisabled()
{		
	element.style.cursor			= "Default";
	element.style.font				= "Icon";
	element.style.fontWeight		= "normal";
	element.style.padding			= "2px 5px 2px 5px";	
	element.style.whiteSpace		= "nowrap";
	element.style.verticalAlign		= "middle";
	element.style.borderWidth		= "1px";
	element.style.background		= "Transparent";
	element.style.filter			= "chroma(color=#010101) dropshadow(color=ButtonHighlight, offx=1, offy=1) gray() chroma(color=#ffffff) chroma(color=#fefefe) chroma(color=#fdfdfd) chroma(color=#fcfcfc) chroma(color=#fbfbfb) chroma(color=#fafafa) chroma(color=#f9f9f9) chroma(color=#f8f8f8) chroma(color=#f7f7f7) chroma(color=#f6f6f6) chroma(color=#f5f5f5) chroma(color=#f4f4f4) chroma(color=#f3f3f3)"	
	
	element.disabled = true;
}	


// function initializes component
function fnInit()
{	    	    
    
    if(isEnabled != null && isEnabled == 0)
    {
		fnSetDisabled()
	}
	else
	{
		fnStyleSetNormal()    
	}
}


function fnMouseOver()
{    
    if(isEnabled == null || isEnabled == 1)
    {
		fnStyleSetUp();  
	}
}

function fnMouseOut()
{	
	if(isEnabled == null || isEnabled == 1)
    {
		fnStyleSetNormal();
		for(i=0;i<element.children.length;i++)
		{
			element.children[i].style.filter = "" 	
		}
	}	
}

function fnMouseDown()
{   
   	if(isEnabled == null || isEnabled == 1)
    {
		fnStyleDown()
   		doHref()	
	}	   	
}

function fnMouseUp()
{
	if(isEnabled == null || isEnabled == 1)
    {
		fnStyleSetUp();
	}		
}


function fnSelect()
{    
    window.event.cancelBubble = true;
    window.event.returnValue = false;   
}


function doHref()
{
    if(href != null && href != "")
    {
		
		switch(target)
		{
			case "_self"        :   window.document.location.href = href;
									break;
	        
			case "_top"         :   window.top.location.href = href;
									break;
	        
			case "_parent"      :   window.parent.location.href = href;
									break;
	        
			case "_blank"       :   window.open(href, target);
									break;
	        
			default             :   findTarget();
									break;
		}
	}
}


function findTarget()
{
    if (target == "")
    {
        window.open(href, "_blank");
        return true;
    }

    //  Is there a frames collection and is this one of them?
    if (window.top.frames.length > 1)
    {
        for (i=0; i<window.top.frames.length; i++)
        {
            if (window.top.frames(i).name == target)
            {
                window.top.frames(i).src = href;
                return true;
            }
        }
    }

    for (i=0; i<window.document.frames.length; i++)
    {
        if (window.document.frames(i).name == target)
        {
            window.document.frames(i).document.location.href = href;
            return true;
        }
    }
    
    window.open(href, target);
}

</script>
</HTC>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?