Internet Explorer上的Javascript代码错误
我的web+Jquery插件在Firefox、Chrome、Safari(win&Osx)和Android上运行良好。但是Windows+InternetExplorer很糟糕,因为它没有加载一些js。我快发疯了,因为它在除IE以外的所有情况下都能工作 IE向我显示3个错误和警告。我的问题是。IE必须在显示好页面之前完善这三个错误吗?例如,我有一个使用jquery的实时搜索,但它在IE上不起作用,因为它显示了该代码的错误 你能帮我验证一下这个“有效”代码吗?提前谢谢大家Internet Explorer上的Javascript代码错误,javascript,jquery,internet-explorer,cross-browser,Javascript,Jquery,Internet Explorer,Cross Browser,我的web+Jquery插件在Firefox、Chrome、Safari(win&Osx)和Android上运行良好。但是Windows+InternetExplorer很糟糕,因为它没有加载一些js。我快发疯了,因为它在除IE以外的所有情况下都能工作 IE向我显示3个错误和警告。我的问题是。IE必须在显示好页面之前完善这三个错误吗?例如,我有一个使用jquery的实时搜索,但它在IE上不起作用,因为它显示了该代码的错误 你能帮我验证一下这个“有效”代码吗?提前谢谢大家 $(functi
$(function() {
// find all the input elements with title attributes
$('input[title!=""]').hint();
}
);
(function ($) {
$.fn.hint = function (blurClass) {
if (!blurClass) {
blurClass = 'blur'; }
return this.each(function () {
// get jQuery version of 'this'
var $input = $(this),
// capture the rest of the variable to allow for reuse
title = $input.attr('title'),
$form = $(this.form),
$win = $(window); function remove() {
if ($input.val() === title && $input.hasClass(blurClass)) {
$input.val('').removeClass(blurClass); }
}
// only apply logic if the element has the attribute
if (title) {
// on blur, set value to title attr if text is blank
$input.blur(function () {
if (this.value === '') {
$input.val(title).addClass(blurClass); }
}
).focus(remove).blur(); // now change all inputs to title
// clear the pre-defined text when form is submitted
$form.submit(remove); $win.unload(remove); // handles Firefox's autocomplete
}
}
); }; }
)(jQuery);
var options, a;
jQuery(function() {
var onAutocompleteSelect = function(value,
data) {
window.open('ITEM.PRO?&token=#AVP'navegante'&S=' + value.substring(value.length - 4)); }
options = {
serviceUrl : 'JQUERY-#AVP$_SETLANG$.pro',
onSelect : onAutocompleteSelect, }; a = $('#query').autocomplete(options); }
);
我在我的网站上尝试了几个j查询。。我面临的最常见问题是这个问题,j query没有任何问题,但我必须下载最新的>jquery.js文件,并将其重命名为jquery.js。您示例中的下一个代码可能有一些错误: 原始代码:
var options, a;
jQuery(function() {
var onAutocompleteSelect = function(value,
data) {
window.open('ITEM.PRO?&token=#AVP'navegante'&S=' + value.substring(value.length - 4)); }
options = {
serviceUrl : 'JQUERY-#AVP$_SETLANG$.pro',
onSelect : onAutocompleteSelect, }; a = $('#query').autocomplete(options); }
);
更改代码:
var options, a;
jQuery(function() {
var onAutocompleteSelect = function(value, data) {
// in next line added plus signs before and after *navegante*
window.open('ITEM.PRO?&token=#AVP'+navegante+'&S='+value.substring(value.length-4));
}; // semicolon added
options = {
serviceUrl : 'JQUERY-#AVP$_SETLANG$.pro',
// in next line removed comma. I think: it generate error in IE
onSelect : onAutocompleteSelect //,
};
a = $('#query').autocomplete(options);
});
(从西班牙语翻译)IE中的JavaScript错误“预期标识符、字符串或数字”。。。“onSelect:onAutocompleteSelect,};a=$('#query').autocomplete(options);}”但它似乎在其他浏览器上运行良好。。。谢谢你什么版本的IE?你试过用IE9调试代码吗?它的开发工具对于调试来说是合理的。