IE 中的 javascript 错误无法查看或解决问题
在 Vista 上的 IE8 中,我收到以下 JS 错误,
<块引用>用户代理:Mozilla/4.0(兼容;MSIE 8.0;Windows NT 6.1;
三叉戟/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;媒体中心电脑6.0; InfoPath.2; .NET4.0C; .NET4.0E)
时间戳:2011 年 9 月 1 日星期四 12:18:24 UTC消息:对象不支持此属性或方法行:28
字符:2 代码:0 URI:
http://www.safetymaintenancecompany.co.uk/media/js/site.js
下面是我的该文件的代码,
$(document).ready(function(){
Cufon.replace('dd h1', { 'fontSize': '50px', 'letterSpacing': '-4px'} ); // Works without a selector engine
$('#slides').slides({
preload: true,
preloadImage: '../images/loading.gif',
play: 5000,
pause: 2500,
slideSpeed: 600,
hoverPause: true,
generatePagination:false
});
//$('footer').height( ($(window).height() - $('#main').height() + "px" ));
$('.title').click(function(event){
event.preventDefault();
});
$('.basic li > h2').hover(function(event) {
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
$("#contactForm").validate({
rules: {
name: "required",
email_address: {
required: true,
email: true
},
phone_number: {
required: true
}
}
});
});
老实说,我看不出这段代码有什么问题,它有什么问题吗?
In IE8 on vista I am getting the following JS error,
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
Timestamp: Thu, 1 Sep 2011 12:18:24 UTCMessage: Object doesn't support this property or method Line: 28
Char: 2 Code: 0 URI:
http://www.safetymaintenancecompany.co.uk/media/js/site.js
Below is my code of said file,
$(document).ready(function(){
Cufon.replace('dd h1', { 'fontSize': '50px', 'letterSpacing': '-4px'} ); // Works without a selector engine
$('#slides').slides({
preload: true,
preloadImage: '../images/loading.gif',
play: 5000,
pause: 2500,
slideSpeed: 600,
hoverPause: true,
generatePagination:false
});
//$('footer').height( ($(window).height() - $('#main').height() + "px" ));
$('.title').click(function(event){
event.preventDefault();
});
$('.basic li > h2').hover(function(event) {
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
$("#contactForm").validate({
rules: {
name: "required",
email_address: {
required: true,
email: true
},
phone_number: {
required: true
}
}
});
});
I honestly cannot see an problems with this code, is there some wrong with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我能正确计数,那就是 $("#contactForm").validate 行,所以也许 $("#contactForm") 返回 null ?您可以先尝试在结果中发出警报,只是为了确定 $("#contactForm") 是否是问题所在,或者是否缺少验证插件。
If I can count correctly, that's the $("#contactForm").validate line, so maybe $("#contactForm") returns null? You might try alert-in the result first, just to be sure if $("#contactForm") is the problem, or a missing validation plugin.
事实证明,IE8 不喜欢我热链接到验证库,但这只是在 Vista 中。我意识到这听起来几乎不可能,但这些都是事实。
It turned out that IE8 did not appreciate me hot linking to the validation library, however this was only in Vista. I realise that sounds almost impossible but those are the facts.