?? floatbutton.js
字號:
function floatButton(id, text, action, imageOff, imageOver,
width, height, title, bgColor, fontFamily, fontSize, fontColor)
{
this.id = id; //用于給這個button指定唯一ID,必須和實例名一致
this.text = text; //button上的文字
this.action = action; //點擊button后觸發的動作,可為空
this.imageOff = imageOff; //平時button的圖標,可為空
this.imageOver = imageOver; //鼠標移到button上的圖標,可為空
this.width = width; //button長,格式推薦為12px
this.height = height; //button
this.title = title; //tooltip
this.bgColor = bgColor; //button背景色,缺省為透明
this.fontFamily = fontFamily; //button字體
this.fontSize = fontSize; //button字體大小,格式推薦為12px
this.fontColor = fontColor; //button字體顏色
//定義對象的方法
this.show = showButton;
this.over = overButton;
this.off = offButton;
this.down = downButton;
this.up = upButton;
this.fire = fireAction;
}
function showButton(){
var strHTML = '';
strHTML += '<span id="'+ this.id + '" class="ButtonNormal" ';
strHTML += 'onmouseover="' + this.id + '.over()" onmouseout="' + this.id + '.off()" ';
strHTML += 'onmouseup="' + this.id + '.up()" onmousedown="' + this.id + '.down()" ';
if (this.title != null)
strHTML += ' title="' + this.title + '"';
if (this.action != null)
strHTML += ' onclick="' + this.id + '.fire()"';
strHTML += ' style="';
if (this.width != null)
strHTML += 'width:' + this.width + ';';
if (this.height != null)
strHTML += 'height:' + this.height + ';';
if (this.bgColor != null)
strHTML += 'background-color:' + this.bgColor + ';';
if (this.fontFamily != null)
strHTML += 'font-family:' + this.fontFamily + ';';
if (this.fontSize != null)
strHTML += 'font-size:' + this.fontSize + ';';
if (this.fontColor != null)
strHTML += 'color:' + this.fontColor + ';';
strHTML += '"><center>';
if (this.imageOff != null)
strHTML += '<img align="absMiddle" id="' + this.id + '_image" src="' + this.imageOff + '" style="vertical-align:bottom"> ';
strHTML += this.text;
strHTML += '</center></span>';
//alert(strHTML);
document.write(strHTML);
}
function fireAction(){
eval(this.action);
}
function overButton(){
if (typeof(document.all(this.id)) == "object")
document.all(this.id).className = "ButtonUp";
if (this.imageOver != null)
if (typeof(document.all(this.id + "_image")) == "object")
document.all(this.id + "_image").src = this.imageOver;
}
function offButton(){
if (typeof(document.all(this.id)) == "object")
document.all(this.id).className = "ButtonNormal";
if (this.imageOff != null)
if (typeof(document.all(this.id + "_image")) == "object")
document.all(this.id + "_image").src = this.imageOff;
}
function downButton(){
if (typeof(document.all(this.id)) == "object")
document.all(this.id).className = "ButtonDown";
}
function upButton(){
if (typeof(document.all(this.id)) == "object")
document.all(this.id).className = "ButtonUp";
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -