youtube url rel=0在javascript中不起作用

youtube url rel=0在javascript中不起作用,javascript,youtube-javascript-api,Javascript,Youtube Javascript Api,youtube url在javascript中不起作用,为什么? 我的代码中的错误在哪里: $(document).ready(function(){ api_images = ['http://www.youtube.com/watchv=OyQoHmcunk&rel=0&fs=0&width=640&height=360']; api_titles = ['Title 1']; api_descriptions =

youtube url在javascript中不起作用,为什么? 我的代码中的错误在哪里:

  $(document).ready(function(){ 
  api_images = ['http://www.youtube.com/watchv=OyQoHmcunk&rel=0&fs=0&width=640&height=360'];
 api_titles = ['Title 1'];
 api_descriptions = ['']
 $.prettyPhoto.open(api_images,api_titles,api_descriptions);
 });

您缺少实际将路径与查询字符串分开的

api_images = ['http://www.youtube.com/watch?v=OyQoHmcunk&rel=0&fs=0&width=640&height=360'];
//                                         ^
如果没有它,您应该会收到404响应,一个像样的javascript调试器会告诉您。您正在使用调试器吗

此外,根据使用的
DOCTYPE
,以及这是来自内联还是外部
,对
&
进行HTML编码可能是必要的,也可能是另一个问题来源:

api_images = ['http://www.youtube.com/watch?v=OyQoHmcunk&rel=0&fs=0&width=640&height=360'];
//                                                      ^     ^    ^         ^

您缺少实际将路径与查询字符串分开的

api_images = ['http://www.youtube.com/watch?v=OyQoHmcunk&rel=0&fs=0&width=640&height=360'];
//                                         ^
如果没有它,您应该会收到404响应,一个像样的javascript调试器会告诉您。您正在使用调试器吗

此外,根据使用的
DOCTYPE
,以及这是来自内联还是外部
,对
&
进行HTML编码可能是必要的,也可能是另一个问题来源:

api_images = ['http://www.youtube.com/watch?v=OyQoHmcunk&rel=0&fs=0&width=640&height=360'];
//                                                      ^     ^    ^         ^

你不应该改变你的问题,这样错误就消失了。你应该把它放在那里,这样这个页面将来对其他人有意义。回滚以演示错误,这在接受的答案中得到了解决。你不应该更改你的问题,这样错误就消失了。你应该把它放在那里,这样这个页面对将来的其他人有意义。回滚以演示错误,这在接受的答案中得到了解决。