【发布时间】:2011-06-25 09:44:38
【问题描述】:
我在 IE 中使用 Jquery 时遇到问题,代码无法正常工作,谁能帮助我。
http://efm.net.au/component/content/article/54
请在 IE 和 FF(或opera、safari、chrome)中检查并选择状态,您会看到俱乐部已加载但未显示在 IE 中,但它们显示在 FF 中。
请帮助它的那种紧急。 谢谢
函数加载俱乐部() { var st = document.getElementById("State").value; if(st != "选择状态") { jQuery("#loaderBox").css("display","block"); //alert(document.getElementById("Club").innerHTML); //alert($("#State").val()); /*$("div#Club_container").remove();*/ setTimeout('jQuery(".club-drop input").remove();',100); setTimeout('jQuery("#Club_container").remove();',100); 如果(窗口.XMLHttpRequest) {// IE7+、Firefox、Chrome、Opera、Safari 的代码 xmlhttp=新的 XMLHttpRequest(); } 别的 {// IE6、IE5的代码 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=函数() { 如果(xmlhttp.readyState==4 && xmlhttp.status==200) {/* $(".state-drop input#State_input").remove(); $("div#State_container").remove(); $(".club-drop 输入#Club_input").remove(); $("div#Club_container").remove();*/ //setTimeout('$(".state-drop").remove()',500); if(jQuery("#club1").length > 0) { document.getElementById("club1").innerHTML=xmlhttp.responseText; document.getElementById("club2").innerHTML=xmlhttp.responseText; document.getElementById("club3").innerHTML=xmlhttp.responseText; }别的{ document.getElementById("俱乐部").innerHTML=xmlhttp.responseText; } //jQuery("div.state-drop").css("border","none"); jQuery("div.state-drop span").css("display","none"); jQuery('.efm-text input[type="submit"]').removeAttr('disabled'); if(jQuery("#club1").length > 0) { setTimeout("jQuery('#club1').selectbox()",100); setTimeout("jQuery('#club2').selectbox()",100); setTimeout("jQuery('#club3').selectbox()",100); }别的{ setTimeout("jQuery('#Club').selectbox()",100); //jQuery('#Club').selectbox(); } jQuery("#loaderBox").css("display","none"); } } xmlhttp.open("GET","/club/state-club.php?state="+st,true); xmlhttp.send(); }别的{ setTimeout('jQuery(".club-drop input").remove();',100); //jQuery("div.state-drop").css("border","1px solid red"); jQuery("div.state-drop span").css("display","block"); jQuery("div.state-drop span").css("color","red"); jQuery('.efm-text input[type=submit]').attr('disabled', 'disabled'); if(jQuery("#club1").length > 0) { document.getElementById("club1").innerHTML="先选择状态"; document.getElementById("club2").innerHTML="先选择状态"; document.getElementById("club3").innerHTML="先选择状态"; setTimeout("jQuery('#club1').selectbox()",100); setTimeout("jQuery('#club2').selectbox()",100); setTimeout("jQuery('#club3').selectbox()",100); }别的{ document.getElementById("Club").innerHTML="先选择状态"; setTimeout("jQuery('#Club').selectbox()",100); } } }【问题讨论】:
-
@user612703 - 您可以尝试在此处发布不起作用的代码。仅仅发布一个网站链接不会给你任何答案。顺便说一句:无论如何,它似乎在 IE 中运行良好!
-
它对我或我的老板不起作用,我的老板因为它不起作用而要杀了我,我尝试了很多技术但它在 IE 上不起作用(我有 IE8 )
-
如果你打算使用 jQuery,你不妨将它用于一切,例如不要使用 innerHTML()、ActiveXObject/XMLHttpRequest 或 onreadystatechange(),因为 jQuery 已经为这些提供了不错的跨浏览器实现。
-
我无法很好地理解 jquery 的 .ajax() 方法,这就是我选择老式 ajax 的原因
-
我不知道这是否是您的问题,但您的回复如下所示:“
Herston
" 第 1 点。您不应该包含
标签,因为我不确定它们是否包含在 中有效,因此 IE 可能无法正常工作。第 2 点。您不应该返回 html。您应该返回基本对象并从中构建您的选择选项。