IE 7没有选择Php生成并使用jquery函数调用的所有行

IE 7没有选择Php生成并使用jquery函数调用的所有行,php,javascript,jquery,Php,Javascript,Jquery,大家好,我有一个由php创建的表单。它包含所有用户收到的电子邮件。每行都有一个复选框,以及所有其他用户信息。Firefox的工作方式很有魅力,但IE在选择所有复选框时遇到了麻烦。只有前2个被选中????? 结构是这样的: PHP和HTML代码: $this->requestsMail .='<form name="selectDelete" class="selectDelete"> <table id="inboxTable" class="txt13" width="

大家好,我有一个由php创建的表单。它包含所有用户收到的电子邮件。每行都有一个复选框,以及所有其他用户信息。Firefox的工作方式很有魅力,但IE在选择所有复选框时遇到了麻烦。只有前2个被选中????? 结构是这样的:

PHP和HTML代码:

$this->requestsMail .='<form name="selectDelete" class="selectDelete">
<table id="inboxTable" class="txt13" width="800px">
<tr><th align="left" style="text-decoration:underline"><input type="checkbox" name="selectAll" class="selectAll"/></th>
    <th style="text-decoration:underline">From</th><td width="20px"></td><th style="text-decoration:underline">Subject
    </th><td width="20px"></td>
    <th style="text-decoration:underline">Date</th><td width="20px"></td>
    <th style="text-decoration:underline">Action</th></tr>';

    $classCounter=0;
while($info=mysql_fetch_array($result)){
    $sender=$info['sender'];
    $date=date("m/d/y- h:i:s A",$info['date']); //takes timeStamp in db & converts to m/d/y - time
    $subject=$info['subject'];
    $message=$info['message'];
    $id = $info['id'];


    $this->requestsMail .='
    <tr>
    <td width="20px"><input type="checkbox" name="delID" class="delID" value="'.$id.'"/></td>
    <td align="center" width="150px"><a href="profile.php?username='.$sender.'">'.substr($sender,0,18).'</a></td>
    <td width="20px"></td>
    <td align="left" width="100px" height="20px">'.substr($subject,0,18).'</td>
    <td width="20px"></td>
    <td align="center" width="150px">'.$date.' - '.$hours.'</td>
    <td width="20px"></td>
    <td width="100px">
    <a href="#" class="showMail">read</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
<tr>
<td colspan="7">
<div class="displayMail" style="display:none; margin:10px 60px 10px 80px" >

    <!--Display user message-->
    <div align="left" class="mainContent">
        <div align="center" id="postContent">                        
            <table id="userPost" width="590px">
                <tr>
                    <td width=100>'.$dbConn->getUserSimplePic($sender).'</td>
                    <td>
                        <div style="text-align:right; margin:0px 25px 15px 0px;"<span class="smallTxt"><a href="'.$id.'" class="delMail">Delete</a></span></div>
                        <div class="message" style="margin:5px 15px;">'.$message.'</div>
                        <div class="sender" style="text-align:right; margin:15px 50px 0px 50px;">-<span class="smallTxt"> '.$sender.' @ '.$date.'<div><a href="#" class="replyLink">reply</a></div></span></div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div><!--end displayMail-->

</td></tr>
    <!-- Confirm delete?-->
    <tr><td colspan="7" align="center"><div class="confirmDelete" style="display:none; margin-bottom:50px; color:#ff8c00; font-size:18px;">
        Delete this email:&nbsp;&nbsp;<a href="inbox" class="delLinkYes" title="Delete email!">Y</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="delLinkNo" title="Do not delete.">N</a> ?
    </div></td></tr>

<tr>
    <td colspan="7">
        <div class="replyDiv" align="center" style="display:none; margin:10px 60px 10px 10px;">

            <form width="350px" class="userReplyForm" name="userReplyForm" method="post" action="#">
            <input type="hidden" class="date" name="date" value="'.time().'"/>
            <input type="hidden" class="sender" name="sender" value="'.$username.'"/>
            <input type="hidden" class="recipient" name="recipient" value="'.$sender.'"/>
            <table align="center" width="350px" class="smallTxt userDetails">
                <tr>
                    <td align="left" width="350px"><input type="text" class="subject" name="subject" size=30 value="RE:'.$subject.'"/></td></tr>
                <tr>
                    <td width="350px"><textarea rows="6" cols="42" class="message" name="message"></textarea></td></tr>
                <tr>
                    <td align="center"><input type="submit" name="Submit" class="submitBtnSmallLong" value="Send Reply"/></td></tr>
            </table>
            </form>

        </div>
        <div class="emailSent" align="center" style="display:none; margin:10px 60px 10px 10px; color:blue; font-size:18px;">
        </div>
    </td>
</tr>

    ';
$classCounter = $classCounter + 1;
}

      $this->requestsMail .='       
      <tr>
        <td colspan="2"><input type="button" class="submitBtnSmallXtraLong" value="Delete selected" name="delSelectedSentMail" /></td>
        <td><input type="hidden" class="inboxOutbox" value="inbox"/></td>
        <td colspan="3"><div id="delStatus"></div></td></tr>
      </table></form><br/><br/><!--<div class="dashed"></div>-->'; 

有什么建议说明IE为什么会出问题吗?

我没有回答


编写它,以便在检测到IE6时,jquery显示一个页面,说明如何快速升级到firefox或chrome。或者如果用户真的想继续使用IE,你也可以在那里添加一个链接。作为开发人员,我们不应该继续使用这些过时的浏览器,尤其是当它们可以免费升级时。有时我们应该教育用户,而不是让他们使用

我真正的答案

我创建了一个基本的复选框选择器。在FireFox(以及其他浏览器)中效果非常好。但它在IE6中不起作用。因此,我进行了一些挖掘,发现了以下情况:

复选框似乎不能保持它的状态 附加到另一个后的状态 元素

在进一步挖掘之后,我发现:

原来这是IE中的一个bug,看起来不会被修复。(尤其是因为它不再受到支持)


那么现在我的真实答案是什么?请参阅
My Not Answer
;)

@php一般来说,你仍然支持ie6吗?是的,哈哈。我的观点是,如果它支持ie6,我就不必担心其他问题(至少我希望如此)。是的,但即使是微软也不支持ie6。说真的,人们还在运行IE6吗?好吧,也许这有点太多了,但问题仍然存在于IE7中,所以它必须在我的代码中。令人惊讶的是,仍然有相当多的人在运行IE6。我想目标受众可能会影响IE的使用版本,但我希望即使在IE6中也能实现功能。我不在乎IE6中的美学是否被扭曲,但我至少喜欢它的功能。顺便说一句,你的日期函数应该被更新为{$date=date(“m/d/y-h:I:sa”),strotime($info['date']);},这对于智慧的小贴士来说是足够公平的,而且是有意义的。我仍然不明白为什么IE(甚至IE 7)不能正确使用上面的代码?请阅读我的真实答案。这是IE中的一个缺陷。据我所知,有一个解决方法。但这听起来并不有趣。
        $(".selectAll").unbind("click").click(function(e){//Method to get ALL checkboxes at once
        var parentForm = $(this).closest("form"); //get current form handle
        var bool = $(this).is(":checked"); //gets whether selected or not
        //var listSent = new Array();
        var listSent = [];

        $(function(){ //check or uncheck based on root checkbox status
            $(parentForm).find("input:checkbox").attr("checked", bool); //have to use parentFormHandle otherwise goes into next form

            if(bool === true){
            $(parentForm).find(".delID").each(function(index,element){ //uses parentForm to restrict to current working form
                listSent.push( $(this).val());
            }); }

            //display all values in array
            $(".submitBtnSmallXtraLong").unbind("click").click(function(a){
                var selectedBox = $(this).closest("tr").find(".inboxOutbox").val(); //are we to delete from inbox or outbox?
                var delStatHandle = $(this).closest("tr").find("#delStatus");   //handle for delStatus 
                    //alert(selectedBox); return false;

                if(listSent.length >= 1){
                        $(".submitBtnSmallXtraLong").css("background-color","#cccccc").attr("disabled",true);

                        var dataString = "data=" + listSent + "&messageType=" + selectedBox;
                            $.ajax({
                                type: "POST",
                                url:  "ajaxDelSentMailBatch.php",
                                data:  dataString,
                                dataType: "JSON",
                                cache: false,
                                success: function(data){ 
                                    if(data == "true"){//tell user deletion successful
                                        $(delStatHandle).append("Deleted!").fadeIn("slow");
                                        setTimeout(function(){
                                            $(delStatHandle).fadeOut("slow");
                                            location.reload();
                                        },800); 
                                        $(".submitBtnSmallXtraLong").css("background-color","#cecece").attr("disabled",false);
                                    }else{
                                    $("#delStatus").append("Failed to Delete Email/s!").fadeIn("slow");
                                        setTimeout(function(){
                                            $(delStatHandle).fadeOut("slow");
                                            location.reload();
                                        },800); 
                                    $(".submitBtnSmallXtraLong").attr("disabled",false);
                                    }
                                }
                            });

                }
            });

        });
    });