jQuery多级可排序列表IE问题

时间:2011-05-04 14:00:43

标签: php jquery internet-explorer

下午好Stackoverflow,

今天,当我使用带有Ajax的jQuery库时,我像往常一样得到了IE。

那么我的问题是什么,请看看我的现场演示:http://194.247.30.66/~keizer/iemakesmesad/

尝试在FF / Chrome中设置项目,然后在IE中进行测试,因为比尔盖茨,我们都将面对这些问题。

可能的解释:IE抓取整个ul而不是ul中的ul ..任何解决方案?

index.php代码

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <script type="text/javascript">
      // When the document is ready set up our sortable with it's inherant function(s)
      $(document).ready(function() {
    <?php
    include_once("../ond/inc/php/connect.php");
    $i = 0;
    $result = mysql_query("SELECT * FROM paginas WHERE type='0' ORDER BY id ASC");      
    while($row = mysql_fetch_array($result))
    {       
        $i++;
        $result2 = mysql_query("SELECT * FROM paginas WHERE type=".$row{"id"}." ORDER BY id ASC LIMIT 1");   
        while($row2 = mysql_fetch_array($result2))
        {   

            echo '  $("#submenu_list'.$i.'").sortable({
                    handle : \'.handle\',
                    update : function () {
                    var order = $(\'#submenu_list'.$i.'\').sortable(\'serialize\');
                    $("#info").load("process-sortable.php?"+order);
                        }
                    });
                ';
        }                   
    }       
    ?>      
        $("#menu_list").sortable({
                handle : '.handle',
                update : function () {
                var order = $('#menu_list').sortable('serialize');
                $("#info").load("process-sortable.php?"+order);
            }
        });
    });
    </script>
    </head>
    <body>
    <?php       


            $result = mysql_query("SELECT * FROM paginas_test WHERE type='0' ORDER BY position ASC");    
                echo '<table cellspacing="2" cellpadding="2">';
                echo '  <tr>';
                echo '      <th colspan="2" scope="col"><img src="../ond/inc/afb/report.png" />Volgordebepaling</th>';
                echo '  </tr>';
                echo '</table>';
                echo '<ul id="menu_list">';
                $i = 0;
                    while ($row = mysql_fetch_array($result))
                    {   
                        $i++;
                        echo '<li style="list-style:none;" id="listItem_'.$row{"id"}.'">';
                        echo ' <img src="../testajax/arrow.png" alt="move" width="16" height="16" class="handle" /> '.$row{"titel"}.'<br />';
                        #mysql_query("SELECT * FROM paginas WHERE type='0' ORDER BY id ASC");                   
                        $result2 = mysql_query("SELECT * FROM paginas_test WHERE type=".$row{"id"}." ORDER BY position ASC");    
                        echo '<ul id="submenu_list'.$i.'">';
                            while($row2 = mysql_fetch_array($result2))
                            {       

                                    echo '<li style="list-style:none;margin-left:15px;" id="sublistItem_'.$row2{"id"}.'">';
                                        echo '<img src="../testajax/arrow.png" alt="move" width="16" height="16" class="handle" /> '.$row2{"titel"}.'<br />';
                                    echo '</li>';
                            }
                        echo '</ul></li>';
                    }
                echo '</ul>';
                echo '<div id="info"></div>';
    ?>
    </body>
    </html>

process-sortable.php代码:

<?php
include("../ond/inc/php/connect.php");

if(isset($_GET['listItem']))
{
foreach ($_GET['listItem'] as $position => $item)
{
    $sql = "UPDATE `paginas_test` SET `position` = $position WHERE `id` = $item";
    mysql_query($sql);
}
}

if(isset($_GET['sublistItem']))
{
foreach ($_GET['sublistItem'] as $position2 => $item2)
{
    $sql = "UPDATE `paginas_test` SET `position` = $position2 WHERE `id` = $item2";
    mysql_query($sql);
}
}
print_r ($sql);
?>

1 个答案:

答案 0 :(得分:1)