php+js實現新浪滑門效果代碼

來源:互聯網
上載者:User

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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>無標題文檔</title>
<style type="text/css">
<!--

#header1 {
background-color: #ffffff;
height: 200px;
width: 500px;
margin: 0px;
padding: 0px;
border: 0px;
font-family: "宋體";
font-size: 12px;
line-height:150%;
}
#menu1 {
margin: 0px;
padding: 0px;
list-style-type: none;
}
#menu1 li {
display: block;
width: 100px;
text-align: center;
float: left;
margin: 0px;
padding-top: 0.2em;
padding-right: 0px;
padding-bottom: 0.2em;
padding-left: 0px;
cursor: hand;


}
#main1 li
{
list-style-type:none;

}
.sec1 { background-color: #FFFFCC;}
.sec2 { background-color: #FEB97A;}
.block { display: block;}
.unblock { display: none;}
A:link {COLOR: #000000; TEXT-DECORATION: none}
A:visited {COLOR: #000000; TEXT-DECORATION: none}
A:active {COLOR: #000000; TEXT-DECORATION: none}
A:hover {RIGHT: 0px; COLOR: #ff0000; POSITION: relative; TOP: 1px; TEXT-DECORATION:

underline}
-->
</style>
<%
function InterceptString(txt,length)'根據中英文字元不同來截取字元
txt=trim(txt)
x = len(txt)
y = 0
if x >= 1 then
for ii = 1 to x
if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是漢字
y = y + 2
else
y = y + 1
end if
if y >= length then
txt = left(trim(txt),ii) '字串限長
exit for
end if
next
InterceptString = txt
else
InterceptString = ""
end if

End Function

dim

conn,rs1,type1,MM_conn_STRING,rs2,type2,SQL1,SQL2,SQL3,SQL4,SQL5,rs3,rs4,rs5,type3,type4,t

ype5
MM_conn_STRING = "Driver={SQL

Server};database=sanxt;server=localhost;uid=sanxt;pwd=sanxt;"
Set conn = Server.Createobject("ADODB.Connection")
conn.open MM_conn_STRING
Set rs1=Server.CreateObject("ADODB.recordset")
type1="藝術資訊"
SQL1="SELECT top 7 id,caption,content,puttime FROM ccnews where classid='"&Trim(type1)&"'

order by id desc"
rs1.open SQL1,conn,1,3

%>
</head>
<body>
<script language=javascript>
function secBoard1(n)

{

for(i=0;i<menu1.childNodes.length;i++)
menu1.childNodes.className="sec1";
menu1.childNodes[n].className="sec2";

for(i=0;i<main1.childNodes.length;i++)
main1.childNodes.style.display="none";
main1.childNodes[n].style.display="block";

}

</script>

<div id="header1">
  <ul id="menu1">
    <li onMouseOver="secBoard1(0)" class="sec2"> 藝術資訊 </li>
   <li onMouseOver="secBoard1(1)" class="sec1"> 藏家交流  </li>
   <li onMouseOver="secBoard1(2)" class="sec1"> 考古發現 </li>
    <li onMouseOver="secBoard1(3)" class="sec1">專題新聞</li>
  <li onMouseOver="secBoard1(4)" class="sec1"> 三希堂新聞 </li>
</ul>

  <!--內容顯示地區-->

  <ul id="main1">
        <li class="block">
        <%
         do while not rs1.eof
        %>
·<a href="../zxzx/shownews.asp?id=<%=rs1("id")%> "target=_blank><%=InterceptString(rs1

("caption")&"..........................................",48)%

></a>    <%=FormatDateTime(rs1("puttime"),"2")%>
<br /><%rs1.movenext
loop
  %></li><%
rs1.close
set rs1=nothing
  %>

   <li class="unblock"><%
        Set rs2=Server.CreateObject("ADODB.recordset")
        type2="藏家交流"
        SQL2="SELECT top 7 id,caption,content,puttime FROM ccnews where classid='"&Trim

(type2)&"' order by id desc"
rs2.open SQL2,conn,1,3
        do while not rs2.eof %>·<a href="../zxzx/shownews.asp?id=<%=rs2("id")%>"

target=_blank><%=InterceptString(rs2("caption")

&"..........................................",48)%></a>    <%

=FormatDateTime(rs2("puttime"),"2")%><br />
        <%rs2.movenext
loop%></li>
<%rs2.close
set rs2=nothing
%>
       
<li class="unblock"><%
        Set rs3=Server.CreateObject("ADODB.recordset")
        type3="考古發現"
        SQL3="SELECT top 7 id,caption,content,puttime FROM ccnews where classid='"&Trim

(type3)&"' order by id desc"
rs3.open SQL3,conn,1,3
        do while not rs3.eof %>·<a href="../zxzx/shownews.asp?id=<%=rs3("id")%>"

target=_blank><%=InterceptString(rs3("caption")

&"..........................................",48)%></a>    <%

=FormatDateTime(rs3("puttime"),"2")%><br /><%rs3.movenext
loop%></li>
<%rs3.close
set rs3=nothing
%>


<li class="unblock"><%
        Set rs4=Server.CreateObject("ADODB.recordset")
        type4="網站公告"
        SQL4="SELECT top 7 id,caption,content,puttime FROM ccnews where classid='"&Trim

(type4)&"' order by id desc"
rs4.open SQL4,conn,1,3
        do while not rs4.eof %>·<a href="../zxzx/shownews.asp?id=<%=rs4("id")%>"

target=_blank><%=InterceptString(rs4("caption")

&"..........................................",48)%></a>    <%

=FormatDateTime(rs4("puttime"),"2")%><br /><%rs4.movenext
loop%></li>
<%rs4.close
set rs4=nothing
%>
 
 

<li class="unblock"><%
        Set rs5=Server.CreateObject("ADODB.recordset")
        type5="專題新聞"
        SQL5="SELECT top 7 id,caption,content,puttime FROM ccnews where classid='"&Trim

(type5)&"' order by id desc"
rs5.open SQL5,conn,1,3
        do while not rs5.eof %>·<a href="../zxzx/shownews.asp?id=<%=rs5("id")%>"

target=_blank><%=InterceptString(rs5("caption")

&"..........................................",48)%></a>    <%

=FormatDateTime(rs5("puttime"),"2")%><br /><%rs5.movenext
loop%></li>
<%rs5.close
set rs5=nothing
%>
  </ul>
  <!--內容顯示地區-->
</div>

</body>
</html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.