按标签显示新闻

来源:互联网 发布:淘宝一键复制有违规吗 编辑:程序博客网 时间:2024/04/30 11:31
 

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>js中国滑动门技术</title>
<style media="screen" type="text/css">

*{font-size:14px;}
html,body{margin:0;text-align:center;over-flow:hidden;height:100%;width:400;}
UL{list-style-type:none; margin:0;}

/* 标准盒模型 */
.ttl{height:18px;}
.ctt{height:350px;padding:6px;clear:both;background-image: url('images/bgnewlist1.png');border:0px solid border-top:0;text-align:left;background-image: url('images/bgnewlist.png');}
.w936{margin:0px 0px;clear:both;width:276px;/*这里调整整个滑动门的宽度*/}

 


/* TAB 切换效果 */
.tb_{font-size:14px; background-image: url('images/bgnewlist1.png');}
.tb_ ul{height:36px;padding-left:0px; font-size:14px;}
.tb_ li{float:left;height:30px;line-height:30px;width: 92px;cursor:pointer; padding:0px; margin:0px; font-size:14px; }

/* 用于控制显示与隐藏的css类 */
.normaltab   { background-image:url('images/bgnewlist2.png'); background-repeat: no-repeat; color:#1F3A87; font-size:14px;}
.hovertab    { background-image: url('images/bgnewlist1.png'); background-repeat: no-repeat; color:#1F3A87; font-weight:bold ;font-size:14px;}
.dis{display:block; padding:10px 0; line-height:12px;}
.undis{display:none;}

/*显示more*/
.more {
 background-image: url('images/bgnewlist.png');
 padding:0px 5px 15px 10px;
}
li {margin:0;padding:10px 4px; font-size:12px;line-height:25px;vertical-align:bottom;}

</style>
<script type="text/javascript" language="javascript">
//<!CDATA[
function g(o){return document.getElementById(o);}
//参数说明:n为标签编号,m为标签数量,q为标签名称的前缀,如id=tb_1中的"tb_",p为内容层的前缀,如id=tbc_01的"tbc_0"
function HoverLi(n,m,q,p){
//m为标签数量 m=6
//q为前缀  q=tb_
//如果有N个标签,就将i<=N;
//兼容IE7,FF,IE6

for(var i=1;i<=m;i++)
{
g(q +i).className='normaltab';
g(p+i).className='undis';
}
g(p+n).className='dis';
g(q+n).className='hovertab';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
//]]>
</script>
</head>
<body>
<div class="w936">
<div id="tb_" class="tb_">
<ul>
<li id="tb_1" class="hovertab" onmouseover="x:HoverLi(1,3,'tb_','tbc_0');">

<a href="newslist.asp?newsclass=1">公司新闻</a></li>
<li id="tb_2" class="normaltab" onmouseover="i:HoverLi(2,3,'tb_','tbc_0');">
<a href="newslist.asp?newsclass=2">行业新闻</a></li>
<li id="tb_3" class="normaltab" onmouseover="a:HoverLi(3,3,'tb_','tbc_0');">
<a href="newslist.asp?newsclass=5">健康园地</a></li>

</ul>
</div>
<div class="ctt">
<div class="dis" id="tbc_01">
<%
set rs=server.CreateObject("adodb.recordset")
   sql="select top 12 * from News inner join NewsClass on News.NewsClassID=NewsClass.NewsClassID"
     sql=sql&" where NewsClass.NewsClassName='公司新闻' order by NewsDate desc"
     rs.open sql,conn,1,1
    do while not rs.eof
     %>
     <img src="images/jt.gif"/>&nbsp;&nbsp;&nbsp;
     <a href="newsshow.asp?newsid=<%=rs("NewsID")%>">
      
      <%
        dim newsclassid
        newsclassid=rs("newsclassid")
       dim count
       dim str
        count=len(rs("NewsTopic"))
        str=rs("NewsTopic")
        if count>16 then
         str=Mid(str,1,15)
         response.write str&"......"
        else
         response.write str
        end if      
      %></a><br><p>
    <% 
      rs.movenext
      loop
      rs.close
      %>
      <li><a href="newslist.asp?newsclass=<%=newsclassid%>">more>></a></li>
</div>
<div class="undis" id="tbc_02">
<%
   sql="select top 12 * from News inner join NewsClass on News.NewsClassID=NewsClass.NewsClassID"
     sql=sql&" where NewsClass.NewsClassName='行业新闻' order by NewsDate desc"
     rs.open sql,conn,1,1
    do while not rs.eof
     %><img src="images/jt.gif"/>&nbsp;&nbsp;&nbsp;
     <a href="newsshow.asp?newsid=<%=rs("NewsID")%>">
      <%        ‘超过字数显示省略号,以至新闻标题不换行显示
        newsclassid=rs("newsclassid")       
        count=len(rs("NewsTopic"))
        str=rs("NewsTopic")
        if count>16 then
         str=Mid(str,1,15)
         response.write str&"......"
        else
         response.write str
        end if      
      %>
      </a><br><p>
    <% 
      rs.movenext
      loop
      rs.close
      %>
      <li><a href="newslist.asp?newsclass=<%=newsclassid%>">more>></a></li>
</div>
<div class="undis" id="tbc_03">
<%
   sql="select top 12 * from News inner join NewsClass on News.NewsClassID=NewsClass.NewsClassID"
     sql=sql&" where NewsClass.NewsClassName='健康园地' order by NewsDate desc"
     rs.open sql,conn,1,1
    do while not rs.eof
     %>
     <img src="images/jt.gif"/>&nbsp;&nbsp;&nbsp;
     <a href="newsshow.asp?newsid=<%=rs("NewsID")%>">
      <%       
        newsclassid=rs("newsclassid")       
        count=len(rs("NewsTopic"))
        str=rs("NewsTopic")
        if count>16 then
         str=Mid(str,1,15)
         response.write str&"......"
        else
         response.write str
        end if      
      %>
      </a><br><p>
    <% 
      rs.movenext
      loop
      rs.close
      %>
      <li><a href="newslist.asp?newsclass=<%=newsclassid%>">more>></a></li>
</div>

</div>

</div>


</body>
</html>

原创粉丝点击