<li>中的链接仅适用于IE </li> <table> </table>

时间:2012-12-09 04:29:52

标签: php hyperlink html-table html-lists

每个&lt;内部的链接li>标签在IE9中不起作用,虽然它们在其他浏览器上工作正常......我无法理解为什么......我检查了重叠元素但我似乎无法找到任何和我不使用任何z-index或绝对/固定定位。它可能是IE的东西吗?

function getNews()
{
    global $db;

    $query = 'SELECT * FROM news';

    if($stmt = $db->prepare($query))
    {
        $html = '';
        $header = '<table cellpadding="0" cellspacing="0" style="width:100%;text-align:left;">'
                    .'<tr>'
                        .'<th class="news-id">'
                            .'ID'
                        .'</th>'
                        .'<th class="news-title">'
                            .'Title'
                        .'</th>'
                        .'<th class="news-when">'
                            .'Timestamp'
                        .'</th>'
                        .'<th class="new-vis">'
                            .'Visible'
                        .'</th>'
                    .'</tr>'
                .'</table>';


        $stmt->execute();
        $result = $stmt->fetchAll(PDO::FETCH_ASSOC);

        $class_one = 'li-bg-one';
        $class_two = 'li-bg-two';

        $c = 0;

        foreach($result as $key => $myrow)
        {

            if($c == 0)
            {
                $class = $class_one;
                $c = 1;
            }
            else
            {
                $class = $class_two;
                $c = 0;
            }

            $html .= '<li news-id="'.$myrow['id'].'" class="admin-list-item '.$class.'">'
                        .'<a style="display:block;" href="/administrator.php?content=news&id='.$myrow['id'].'">'
                        .'<div>'
                        .'<table cellpadding="0" cellspacing="0" style="width:100%;">'
                            .'<tr>'
                                .'<td valign="top" class="news-id">'
                                .$myrow['id']
                                .'</td>'
                                .'<td valign="top" class="news-title">'
                                .'<div>'
                                .limit_words($myrow['title'], 10)
                                .'</div>'
                                .'</td>'
                                .'<td valign="top" class="news-when">'
                                .$myrow['timestamp']
                                .'</td>'
                                .'<td valign="top" class="new-vis">'
                                .$myrow['visible']                          
                                .'</td>'
                            .'</tr>'
                        .'</table>'
                        .'</div>'
                        .'</a>'
                    .'</li>';
        }
        return $header . '<ul>' . $html . '</ul>';
    }
}

我向你保证css没什么奇怪的,除非我遗漏了什么

#news-list, #slides-list{
    margin:20px;
    background-color:white;
    overflow-x:hidden;
    overflow-y:scroll;
    height:350px;
    border:1px solid lightgray;
}

#news-list a:hover, #slides-list a:hover{
    color:#333 !important;
}

.admin-list-item
{
    list-style:none;
    background:none !important;
}

.admin-list-item:hover{
    background-color: rgb(123, 219, 243) !important;
    cursor: pointer;
}

.li-bg-one
{
    background-color: #bdbdbd !important;
}

.li-bg-two
{
    background-color:#fff !important;
}

#news-list td, #news-list td a, #news-list td div, #news-list div a    
{
    color:#333;
    font-weight:bold;
    font-size:12px;
    font-family: Arial,Tahoma;
}

#news-list th
{
    color:#a00000;
    font-weight:bold;
    font-size:12px;
    font-family: Arial,Tahoma;
}

#news-list .news-id{
    width:50px;
}

#news-list td.news-id{
    text-align:left;
}

#news-list .news-title{
    width:450px;
}

#news-list td.news-title{
    text-align:left;
}

#news-list td.news-title div{
    width:450px;
    overflow: hidden;
    text-overflow:ellipsis;
    white-space: nowrap;
}

#news-list .news-when{
    width:150px;
}

#news-list td.news-when{
    text-align:left;
}

#news-list .news-vis{
    width:30px;
}

#news-list td.news-vis{
    text-align:center;
}


#news-editor, #slides-editor{
    padding:20px;
    text-align:left;
    border-top:1px solid #a00000;
}

#edit-news-title, #edit-slider-title, #edit-slider-url{
    width:700px;
    text-align:left;
    min-height:32px;
    line-height:32px;
    padding:5px;
    color:#a00000;
    font-family:Arial,Tahoma;
    font-weight:bold;
    font-size:16px;
    position:relative;
    border-radius:10px;
    -moz-border-radius:10px;
    border:1px solid lightgray;
}

#edit-news-img, #edit-slider-img{
    margin-top:10px;
    margin-bottom:10px;
}

1 个答案:

答案 0 :(得分:0)

news-id不是有效的HTML attr。

找到这个:

 $html .= '<li news-id="'.$myrow['id'].'" class="admin-list-item '.$class.'">'

并替换为:

 $html .= '<li id="'.$myrow['id'].'" class="admin-list-item '.$class.'">'

或使用HTML5数据attr:

 $html .= '<li data-news-id="'.$myrow['id'].'" class="admin-list-item '.$class.'">'