11 29 , 2008
Tagged: bind ,function ,JS ,mootool ,方便 ,框架 ,类 |
Cat: mootools |
mootool这个类oo型的S框架果然强大!其中的function类有一个方法叫bind,这东西太方便了!怎样方便,请看以下代码:
HTML代码:
mootool要变我颜色了!
JS代码:
var e=$('element');
function ChangeColor(){
this.setStyle('background','red');
}
var ChangeColorBind=ChangeColor.bind(e);//这样ChangeColor函数里面的this就被e元素替换了!
ChangeColorBind();
也许这里你还没看见这个有多方便方便,但是涉及到嵌套函数的时候你就知道它有多强大了!
11 14 , 2008
Tagged: javascript ,joe ,JS ,mootools ,mootools教程 ,onHide ,onShow ,tips ,Tips类 ,Tutorial ,代码 ,元素集合 ,方便 ,私房猫 |
Cat: javascript , mootools , 网络笔记 |
mootools的Tips类是非常简单易用,但又非常强悍的。看以下例子:
以下是html
无标题文档
window.addEvent('domready', function() {
//这里填写本实例mootools代码
});
http://xiebiji.com
本实例CSS代码
.tool-tip {
color: #fff;
width: 139px;
z-index: 13000;
}
.tool-title {
font-weight: bold;
font-size: 12px;
margin: 0;
color: #9FD4FF;
padding: 8px 8px 4px;
background:#000000 top left;
}
.tool-text {
font-size: 12px;
padding: 4px 8px 8px;
background:#000000 bottom right;
}
.custom-tip {
color: #000;
width: 130px;
z-index: 13000;
}
.custom-title {
font-weight: bold;
font-size: 12px;
margin: 0;
color: #3E4F14;
padding: 8px 8px 4px;
background: #C3DF7D;
border-bottom: 1px solid #B5CF74;
}
.custom-text {
font-size: 12px;
padding: 4px 8px 8px;
background: #CF...