开发者

Javascript code error at Internet Explorer

开发者 https://www.devze.com 2023-04-06 07:30 出处:网络
My web + Jquery plugins is working well on Firefox, Chrome, Safari (win & Osx) & Android also. But it sucks with Windows + Internet Explorer because it does not load some js. 开发者_Python百科

My web + Jquery plugins is working well on Firefox, Chrome, Safari (win & Osx) & Android also. But it sucks with Windows + Internet Explorer because it does not load some js. 开发者_Python百科I am going crazy because it works in all scenarios but IE.

IE shows me 3 errors warnings. My question is. Must IE compile perfect all these 3 errors before showing well the page? For example I have a real time search using jquery, but it does not work on IE due it shows me an error with that code.

Please could you help me validate this "valid" code? Thank you all in advance

    $(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); }
); 


Next code in your example maybe have some errors:

original code:

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); }
); 

changed code:

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);
}); 


I tried several j queries in my website .. Most common problem i faced was this and there was nothing wrong with j query but i had to download the latest >jquery.js file and rename it also with the jquery.js ..

0

精彩评论

暂无评论...
验证码 换一张
取 消