日期:2014-05-16  浏览次数:20746 次

恨死了不兼容 - Web 开发 / Ajax
搞了一天,也没把下面的问题搞兼容,在IE下,setInterval ajax可用,在谷歌和FF下都不起作用,用了无数方法,还是没有作用,不知道是我代码写得有误还是怎么的,知道的看一下
HTML code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="exam_now.aspx.cs" Inherits="Maj.WebSite.exam_now" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="skins/exampaper.css" rel="stylesheet" type="text/css" />
    <script src="/include/js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="/include/js/tab.js" type="text/javascript"></script>
    <script src="/include/js/jquery.cookie.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        var id = <%#cntId %>;
        var tim=null;

         var xmlHttpequest=null;
         function finishExam()
         { 
            clearInterval(tim);
            var exam1 = "";
            var exam2 = "";
            var exam3 = "";
            var result = "";
            $(".paper1 .examvalue").each(function () {
                var sign = $(this).attr("rel");
                var tmp = "";
                $("#ansower_" + sign + " input[type='radio']").each(function () {
                    if ($(this).attr("checked")) tmp = $(this).val();  //if ($(this).attr("checked")) tmp += "-" + $(this).val();
                });
                exam1 += tmp + "|";
            });
            $(".paper2 .examvalue").each(function () {
                var tmp = ""; // $(this).attr("rel") + "-";
                $("#ansower_" + $(this).attr("rel") + " input[type='checkbox']").each(function () {
                    if ($(this).attr("checked")) tmp += $(this).val() + ",";
                });
                tmp = tmp.substr(0, tmp.length - 1) + "|";
                exam2 += tmp;
            });
            $(".paper3 textarea").each(function () {
                exam3 += $(this).val() + "|";
            });
            result = exam1 + exam2 + exam3;
            result = result.substr(0, result.length - 1);
            $.get("/tools/check_exam.aspx", { cntid:<%#cntId %>, logid:<%#logId %>, data: result, r: Math.random() },
                function(data)
                {
                   var txt=data.toString().split("|");
                   p1.innerHTML=txt[0];
                   p2.innerHTML=txt[1];
                   p3.innerHTML=txt[2];
                 });
              //$.cookie("exam", exam1 + exam2);
            AdLayer1.innerHTML="<strong>正在改您的卷子!</strong>";
            AdLayer1.innerHTML="<strong>成功是从错题开始<br>请认真查看错题</strong><br><br><a href=\"exam_complete.aspx?id=" + <%#cntId %> + "&logid=" + <%#logId %> + "\">查看排名</a>";
         }
        
        /*
        function ieajx ()
        {
            if(window.XMLHttpRequest)
            {
               xmlHttpequest=new XMLHttpRequest();
            }
            else if(window.ActiveXObject)
            {
               xmlHttpequest=new XMLHttpRequest("MSXML2.XMLHTTP");
            }
            if(xmlHttpequest)
            {
               xmlHttpeq