各位我刚刚学js我想问一下我如何用下面的这个jquery中调用下面的那个function方法,我现在要做的是当我点击jquery写的那个li改变样式的时候就调用下面的那个function方法,请问如何去做呢!我想起来用changeClick(iFocusChange)这样的方法可是在运行后它提示changeClick没有定义,那该如何去调用呢!
jQuery(document).ready(function changeClick(){
jQuery("#ifocus_btn li").each(function(i){
jQuery(this).click(function(){
jQuery(this).addClass("current").siblings("li").removeClass("current");
});
});
});
function iFocusChange() {
if(!$('ifocus')) return false;
$('ifocus').onmouseover = function(){atuokey = true};
$('ifocus').onmouseout = function(){atuokey = false};
var iFocusBtns = $('ifocus_btn').getElementsByTagName('li');
var listLength = iFocusBtns.length;
iFocusBtns[0].onmouseover = function() {
moveElement('ifocus_piclist',0,0,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',0);
}
if (listLength>=2) {
iFocusBtns[1].onmouseover = function() {
moveElement('ifocus_piclist',0,-353,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',1);
}
}
if (listLength>=3) {
iFocusBtns[2].onmouseover = function() {
moveElement('ifocus_piclist',0,-706,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',2);
}
}
if (listLength>=4) {
iFocusBtns[3].onmouseover = function() {
moveElement('ifocus_piclist',0,-1059,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',3);
}
}
if (listLength>=5) {
iFocusBtns[4].onmouseover = function() {
moveElement('ifocus_piclist',0,-1412,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',4);
}
}
}
setInterval('autoiFocus()',5000);
var atuokey = false;
分享到: