CoolButton ------ JavaScript

xiaoxiao2021-03-06  56

One .coolbutton.js

document.onmouseover = doOver; document.onmouseout = doOut; document.onmousedown = doDown; document.onmouseup = doUp; document.onclick = doClick; function doOver () {var toEl = getReal (window.event.toElement, "className", "CoolButton"); Var fromL = getReal (Window.Event.Fromelement, "classname", "coolbutton"); if (toel == fromel) Return; var cdisabled = el.cdisabled;

CDISABED = (cdisabled! = null); if (el.classname == "coolbutton") El.onSelectStart = new function ("returnaf false"); if ((el.classname == "coolbutton") &&! cdisabled) { IF (El.haveRrow == 1) {Makeraised (EL); Makeraised (EVAL (EL.ANAME));} else {Makeraised (EL)

}

Function doout () {var toout ("ClassName", "ClassName", "ClassName", "ClassName"); Var fromL = GetReal (Window.event.Fromelement, "ClassName", "Coolbutton"); if (TOEL == Return; var el = fromel;

VAR cdisabled = el.cdisabled; cdisabled = (cdisabled! = null);

Var ctoggle = el.ctoggle; Toggle_Disabled = (CToggle! = NULL);

IF (ctoggle && el.value) {MakePressed (EL);

Else IF ((el.classname == "coolbutton") &&! Cdisabled) {if (el.haveRrow == 1) {makeflat (EL); Makeflat (El.aname));} else {Makeflat (EL Makeflat (EL);

}

Function doDown () {EL = getReal (Window.Event.Srcelement, "classname", "coolbutton"); var cdisabled = el.cdisabled; cdisabled = (cdisabled! = null); // if cdisabled Atribute is presentiff El.classname == "coolbutton") &&! cdisabled) {Makepressed (EL)}} Function Doculick () {EL = GetReal (Window.Event.Srcelement, "ClassName", "Coolbutton"); var cdisabled = el.cdisabled ; Cdisabled = (cdisabled! = Null); if (((el.classname == "coolbutton") &&! Cdisabled) {makepressed (el)}}

Function Doup () {EL = GetReal (Window.Event.Srcelement, "ClassName", "CoolButton"); var cdisabled = el.cdisabled; cdisabled = (cdisabled! = null); if ((el.classname == "Coolbutton ") &&! cdisabled) {makeraised (el);}

Function GetReal (EL, TYPE, VALUE) {TEMP = EL; while ((Temp! = null) && (Temp.tagname! = "body")) {if ("temp." type) == value {EL = Temp; Return El;} Temp = Temp.parentelement;} Return EL;}

Function Disable (EL) {

IF (Document.ReadyState! = "Complete") {WINDOW.SETTIMEOUT ("DISABLE (" EL.ID ")", 100); return;} var cdisabled = el.cdisabled; cdisabled = (cdisabled! = null) ; if (cDisabled!) {el.cDisabled = true; if (document.getElementsByTagName) {el.innerHTML = " " " " el.innerhtml " " " ";} else {// ie4 el.innerhtml =' ' el.innerhtml '' '';} if (el.onclick! = NULL) {El.cdisabled_onclick = el.onclic K; El.onclick = null;}}}

Function enable (el) {var cdisabled = el.cdisabled; cdisabled = (cdisabled! = null); if (cdisabled) {el.cdisabled = null; el.innerhtml = el.Children [0] .children [0] .innerhtml ;

IF (el.cdisabled_onclick! = null) {El.onclick = el.cdisabled_onclick; el.cdisabled_onclick = null;}}}

Function makeflat (EL) {with (el.style) {background = ""; border = "1px solid buttonface"; padding = "1px";}} function makeraised (el) {with (el.style) {borderleft = " 1px solid buttonhighlight "; borderright =" 1px solid buttonshadow "; bordertop =" 1px solid buttonhonglight "; borderbottom =" 1px solid buttonshadow "; padding =" 1px ";}}

function makePressed (el) {with (el.style) {borderLeft = "1px solid buttonshadow"; borderRight = "1px solid buttonhighlight"; borderTop = "1px solid buttonshadow"; borderBottom = "1px solid buttonhighlight"; paddingTop = "2px" Paddingleft = "2px"; PaddingBottom = "0px"; paddingright = "0px";}}

document.write ( "