0
4

3 回答 3

1
于 2013-02-14T18:10:05.527 回答
0

未经测试,我认为这条线是错误的:

this.href = this.href.replace(/^".mp4"/, 
     ".html");

^表示以正则表达式开头。尝试这样做:

this.href = this.href.replace(".mp4", 
     ".html");
于 2013-02-14T18:07:43.933 回答
0

只需包装两个答案。你将需要他们两个来使它正确。

$(function(){

$("a.cboxElement[href$='.mp4']")
 .each(function()
{

  this.href = this.href.replace(".mp4", ".html");

});


$(".cboxElement").colorbox({iframe:true, innerWidth:640, innerHeight:370});
});

http://jsfiddle.net/2A3UP/

于 2013-02-14T18:16:28.623 回答