【发布时间】:2012-08-18 19:15:57
【问题描述】:
我使用 JavaScript 注释来设置选项
/*jslint undef: false, browser: true */
根据jslint documentation here 容忍错误排序的函数和变量定义。我也尝试将其设置为“true”,但这也不起作用。
但我还是得到了
'vFlipB' 在定义之前使用。
vFlipB('mi_cover');
这个函数首先在第 299 行被调用:
Mo.UserAny = {
pre : function (o_p) {
vFlipB('mi_cover');
if ((localStorage.hash === '0') || (localStorage.hash === undefined) || (localStorage.hash === null)) {
o_p.result = 'complete';
Vi.Ani.flipP('sp');
return o_p;
}
。 . .
但是直到它下面才被定义:
在 958 上
/**
** vFlipB
*/
function vFlipB( current_id ) {
// turn on
var current_link = document.getElementById( current_id + '_l' ),
current_box = document.getElementById( current_id );
current_box.style.opacity = 1;
current_link.style.borderBottom = '2px solid #31baed';
// turn off
if( vFlipB.previous_box !== undefined && vFlipB.previous_box !== current_box ) {
vFlipB.previous_box.style.opacity = 0;
vFlipB.previous_link.style.borderBottom = '';
}
// set current to static previous
vFlipB.previous_box = current_box;
vFlipB.previous_link = current_link;
}
【问题讨论】:
-
我们可以看看你剩下的代码吗,因为这部分很好
-
无法解决问题..所以我只发布了代码的两个区域。
-
为什么不把函数放在第299行之前呢?
-
你在哪里调用了 jslint 的选项?
-
只是 .js 文件顶部的注释 - /*jslint undef: false, browser: true */
标签: javascript jslint