Javascript SyntaxError:意外标记<; 函数isIE(){ var myNav=navigator.userAgent.toLowerCase(); 返回(myNav.indexOf('msie')!=-1)?parseInt(myNav.split('msie')[1]):false; } window.isIEOld=isIE()&&isIE()599&&!isIEOld&&!isiPad){ el+=''; el+=''; el+=''; }否则{ el=''; } $('.video').prepend(el);
我得到这个js错误,但不知道为什么。。。它不引用行号。我正在Wordpress functions.php中将脚本排队…您的脚本标记不正确:Javascript SyntaxError:意外标记<; 函数isIE(){ var myNav=navigator.userAgent.toLowerCase(); 返回(myNav.indexOf('msie')!=-1)?parseInt(myNav.split('msie')[1]):false; } window.isIEOld=isIE()&&isIE()599&&!isIEOld&&!isiPad){ el+=''; el+=''; el+=''; }否则{ el=''; } $('.video').prepend(el);,javascript,jquery,Javascript,Jquery,我得到这个js错误,但不知道为什么。。。它不引用行号。我正在Wordpress functions.php中将脚本排队…您的脚本标记不正确: <script type="text/javascript"> function isIE () { var myNav = navigator.userAgent.toLowerCase(); return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')
<script type="text/javascript">
function isIE () {
var myNav = navigator.userAgent.toLowerCase();
return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
}
window.isIEOld = isIE() && isIE() < 9;
window.isiPad = navigator.userAgent.match(/iPad/i);
var img = $('.video').data('placeholder'),
video = $('.video').data('video'),
noVideo = $('.video').data('src'),
el = '';
if($(window).width() > 599 && !isIEOld && !isiPad) {
el += '<video autoplay loop poster="' + img + '">';
el += '<source src="' + video + '" type="video/mp4">';
el += '</video>';
} else {
el = '<div class="video-element" style="background-image: url(' + noVideo + ')"></div>';
}
$('.video').prepend(el);
</script>
应明确为:
<script type="text/html">
thx。。我粘贴了一个我正在试验的早期版本。正确的脚本如下所示:
<script type="text/javascript">