0

好吧,每个 < 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;
}

您想使用服务器端内容访问/修改 razor 内容。

但是 MVC 是一种将网站/应用程序构建到 Web 表单的不同方式。

现在有服务器端控件或 web 控件。您可以使用 JQuery 来做同样的事情。

4

1 回答 1

0

news-id 不是有效的 HTML 属性。

找到这个:

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

并替换为:

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

或使用 HTML5 数据属性:

 $html .= '<li data-news-id="'.$myrow['id'].'" class="admin-list-item '.$class.'">'
于 2012-12-09T05:13:12.147 回答