?? oradio.lib.js
字號(hào):
?/*
By Hangring
#2008.02.27#
---
use list:
> global.lib.js
> node.lib.js
> events.lib.js
> node.lib.js
> css.lib.js
---
復(fù)選框
---
包含樣式:
<link rel="stylesheet" href="css/oradio.lib.css" type="text/css" />
*/
function oRadio (name, value) {
this.container = null;
// the radio object
this.radio = null;
// the icon object
this.icon = null;
// radio's name
this.name = name || 'radio_' + Math.random();
// radio's value
this.value = value || '';
// view text
this.text = '';
// checked or not
this.checked = false;
// function
this.check = null;
this.css = {
container:'oradio',
icon:'icon',
icon_checked:'icon-checked',
icon_nonchecked:'icon-nonchecked'
};
}
oRadio.prototype.Init = function () {
};
oRadio.prototype.Create = function () {
var self = this;
oRadio.Union(this, this.name);
var container = this.container = oNode.CreateNode('a');
CSS.AddClass(container, this.css.container);
container.href = '#';
var radio = this.radio = oNode.CreateNode('input');
radio.type = 'radio';
oNode.AddNode(radio, container);
radio.name = this.name;
radio.value = this.value;
var icon = this.icon = oNode.CreateNode('span');
oNode.AddNode(icon, container);
CSS.AddClass(icon, this.css.icon);
if (this.text) {
var label = oNode.CreateNode('label');
oNode.AddNode(label, container);
oNode.AddNode('\x20' + this.text, label);
}
this.check = function (e) {
if (!self.checked) {
self.checked = true;
CSS.ReplaceClass(icon, self.css.icon_nonchecked, self.css.icon_checked);
self.radio.checked = true;
self._Change();
for (var i = 0, len = oRadio[self.name].length; i < len; i++) {
var radio = oRadio[self.name][i];
if (radio != self) {
radio.checked = false;
CSS.ReplaceClass(radio.icon, radio.css.icon_checked, radio.css.icon_nonchecked);
}
}
}
Events.CancelAll(e);
}
Events.AttachEvent(container, 'click', this.check);
Events.AttachEvent(container, 'mouseover', function (e, th) {
self._MouseOver(e, th || this);
});
Events.AttachEvent(container, 'mouseout', function (e, th) {
self._MouseOut(e, th || this);
});
return container;
};
oRadio.prototype._MouseOver = function (e /* window.event|MouseEvent:Object */, th /* :HTMLElement */) {
this.MouseOver(e, th);
};
oRadio.prototype.MouseOver = function (e /* window.event|MouseEvent:Object */, th /* :HTMLElement */) {
};
oRadio.prototype._MouseOut = function (e /* window.event|MouseEvent:Object */, th /* :HTMLElement */) {
this.MouseOut(e, th);
};
oRadio.prototype.MouseOut = function (e /* window.event|MouseEvent:Object */, th /* :HTMLElement */) {
};
oRadio.prototype._Change = function () {
this.Change();
};
oRadio.prototype.Change = function () {
};
oRadio.Union = function (radio /* :oRadio */, name /* radio's name:String */) {
if (typeof this[name] != 'object') this[name] = [];
this[name].push(radio);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -