javascript - JS 意外 token 其他

标签 javascript

我这里有问题......

if (currentScreen=="object" && currentItem[1]!=null){
  gotoElement(currentItem[0], currentItem[1], true, false, currentScreen);
}  else  {
    loadContent("objectMain.php?objectClass=" + currentItem[0],"centerDiv");
} else {
    target=getTargetFromCurrentScreen(currentScreen);
    loadContent(target,"centerDiv"); 
}

enableWidget('menuBarRedoButton');
if (historyPosition == 0) {
    disableWidget('menuBarUndoButton');
}

错误是:

"unexpected token else".

有人可以帮助我吗?

最佳答案

你必须使用 else if() 而不是两个 successif else:

if (first_condition){

} else if(second_condition) {

} else {

}

希望这对您有所帮助。

关于javascript - JS 意外 token 其他,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41167168/

相关文章:

javascript - JQuery 表单验证 if 语句不起作用

javascript - 如何将 json block 作为文件发送给用户

javascript - jQuery 检查类是否存在或有多个类

javascript - React 如何连接 JS 文件和 HTML 文件

javascript - HTML、jQuery、CSS - Width() 在页面加载时返回整个页面宽度而不是 div?

javascript - 我如何注释我想要任何类型作为输入,但与 Flow 的输出类型相同?

javascript - 使用 javascript 添加 RadEditor :getting unterminated string literal error

javascript - 显示 HTTP 请求时间

javascript - 强制在 App 而不是 Safari iOS 中打开 youtube 链接

javascript - 这个 Mongoose 查询的 SQL 等价物是什么