JavaScript - 未捕获的语法错误:意外的令牌)

JavaScript - Uncaught SyntaxError: Unexpected token )

本文关键字:意外 令牌 错误 语法 JavaScript      更新时间:2023-09-26

嗨,这段代码出了什么问题,语法错误在哪里。 我得到了那个错误:

注意:第一个代码块是chrome在自动调整进度上检测错误的地方。

但即使我删除了这个块,错误仍然存在:

编辑2:

我发现了错误!!

<script>
// JavaScript object for later use
var player = new MediaElementPlayer('#player',/* Options */); <--
// ...
</script>

顺便说一下,就像一张便条。 代码正在工作.. 我可以看到视频,但我不希望控制台出现错误。 谢谢

 <script>
$('audio,video').mediaelementplayer({
  // if the <video width> is not specified, this is the default
  defaultVideoWidth: 530,
  // if the <video height> is not specified, this is the default
  defaultVideoHeight: 377,
  autosizeProgress: true,
  // Hide controls when playing and mouse is not over the video
  features: ['playpause','progress','current','duration','tracks','volume','sourcechooser','fullscreen'],
  alwaysShowControls: false,
});
</script>

我还重写了它,看看那里是否有非法字符,=(我找不到问题

在旧版本的IE中,对象文字中多余的逗号将抛出语法错误:

$('audio,video').mediaelementplayer({
  defaultVideoWidth: 530,
  defaultVideoHeight: 377,
  autosizeProgress: true,
  features: ['playpause','progress','current','duration','tracks','volume','sourcechooser','fullscreen'],
  alwaysShowControls: false //Extra Comma Removed
}); //added ;