我现在在用ecmall做二次开发,所有的jquery在firefox浏览器上都能正常运行,但是在IE上都失效了,下面贴一个功能的代码,请帮忙看下如何解决在IE上失效的问题:
HTML代码:
<div class="buyout">
                    <input id="join" class="btn_buy" type="button" value="" />
                  </div>
                  <div id="info" class="ware_cen_info_fun" style="display:none">
                    <div class="ware_center_info_fun">
                      <div> <span class="dialog_title">用户信息</span> <span class="close_link" title="关闭" id="close" onmouseover="this.className = 'close_hover'" onmouseout="this.className = 'close_link'"></span></div>
                      <br />
                      <div class="ware_cen_btn">
                        
                        <ul class="fill_in_fun">
                    
                          <li>
                            <p class="title">用户名称: </p>
                            <p>
                              <input name="link_man" type="text" class="text" />
                            </p>
                          </li>
                          
                          <li class="btn_fun">
                            <input name="join" type="submit" value="参与" />
                          </li>
                        </ul>
                      </div>
                    </div>
                    <div class="ware_cen_bottom_info_fun"></div>
                  </div>
jquery代码:
$(document).ready(function(){
    $('#join').click(function(){
alert(123);
        var qty = 0;
        var error = false;
        var max_per_user = {$goods.max_per_user};
        $('input[ectype="quantity"]').each(function(){
            if(parseInt($(this).val()) > 0 ){
                qty += parseInt($(this).val());
            }
            if($(this).val() !='' && (parseInt($(this).val()) < 0 || isNaN(parseInt($(this).val()))))
            {
                error = true;
            }
        });
        if('{$goods.ican.login}'){
           alert('{$lang.need_login}');
           window.location.href = SITE_URL + '/index.php?app=member&act=login&ret_url=' + encodeURIComponent('index.php?app=goods&id={$goods.goods_id}');
        }else if(error == true){
           alert('{$lang.invalid_quantity}');
        }else if(max_per_user > 0 && qty > max_per_user){
           alert('{sprintf lang=error_max_per_user var1=goods.max_per_user}');
        }else{
            $('#info').show();
            $('input[name="quantity"]').focus();
            $('input[ectype="quantity"]').attr('disabled',true);
        }
    });
});
这个功能是点击按钮后弹出一个隐藏框,在火狐上可以,但是在IE上不行

解决方案 »

  1.   


     var max_per_user = {$goods.max_per_user};//这句话是怎么回事,$good是怎么来的?
      

  2.   

    IE和FF33.5支持的DOM标准不一样。我也是刚学,不知道说的对不对。下面贴段代码。说明点区别
    function createXMLHttpRequest(){
      if(window.ActiveXObject){
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      } else if(window.XMLHttpRequest){
        xmlHttp = new XMLHttpRequest();
      }
    }
    function startRequest(){
    createXMLHttpRequest();
    xmlHttp.open("GET","appendChild.html",true);
    xmlHttp.onreadystatechange = function(){
    alert(xmlHttp.readyState +"  "+ xmlHttp.status);
      if(xmlHttp.readyState == 4 && xmlHttp.status == 0)
       alert("服务器返回:" + xmlHttp.responseText);   
    }
    xmlHttp.send(null);