![]() |
#2
yms1232012-03-02 11:28
|
网页中代码:

<table width="740" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><table width="740" border="0" cellspacing="0" cellpadding="0">
<tr><%
redim bid(4),btl(4),bpic(4)
for i=1 to 4
bid(i)=0
next
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 4 * from hotelsort where bsortid=1 order by pw_id desc,id desc",conn
if not(rs.eof) then
i=1
while not(rs.eof)
bid(i)=rs("id")
btl(i)=rs("title")
bpic(i)=rs("pic")
i=i+1
rs.movenext
wend
end if
rs.close:set rs=nothing
%>
<td width="164" height="50" rowspan="2"><img src="img/fk_top_left.gif" width="160" height="50" /></td>
<td height="10"></td>
</tr>
<tr>
<td width="575" background="img/fk_top_bg.gif" style="padding-left:3px;">
<div id="xianluMiddle_top">
<ul>
<%
for i=1 to 4
%>
<li class="tab<%if i=1 then
response.Write("1")
else
response.Write("2")
end if
%>" id="m0<%=i%>"><%=lenstr(btl(i),7)%></li>
<%next%>
</ul>
</div> </td>
<td width="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top"><table width="740" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11" height="6"></td>
<td width="200"></td>
<td width="495" height="6"></td>
</tr>
<tr>
<td ></td>
<td align="left" width="200"><img src="img/fk_bz1.jpg" border="0"/></td>
<td align="left" valign="top" style="padding-left:4px;">
<%for i=1 to 4%>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from hotel where bsortid=1 and sortid="&bid(i)&" order by pw_id desc,id desc",conn
if not(rs.eof) then
title=rs("title")
other=rs("other")
%>
<div id="c0<%=i%>" <%if i>=2 then response.Write("style='display:none;'") end if%>>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="right"><a href="111.asp"><img src="img/fk_yuyue.jpg" width="108" height="40" border="0"/></a>
</td>
<tr>
<tr>
<td width="153"><a href="bz.asp?bsortid=1&sortid=<%=bid(i)%>"><img src="pic/hotelsort/<%=bpic(i)%>" width="115" height="150" class="newbord2" border="0" alt="<%=btl(i)%>"/></a></td>
<td width="16"></td>
<td width="322" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" height="50" valign="middle"> <a href="show.asp?id=<%=rs("id")%>" title="<%=title%>" class="menu4"><%=lenstr(title,16)%></a></td>
</tr>
<tr>
<td align="left" valign="top" class="font7" style="border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: #c9c9c9; padding-bottom:5px;"><%=lenstr(other,125)%><a href="show.asp?id=<%=rs("id")%>" class="menu5">[详细]</a></td>
</tr>
</table> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="1" style="margin-top:5px;">
<div id="bfzl"> <%
while not(rs.eof)
title=rs("title")
%>
<div id="bfzl_bt"><img src="img/ico2.gif" width="5" height="5" />
<a href="show.asp?id=<%=rs("id")%>"><%=lenstr(title,18)%></a></div>
<%
rs.movenext
wend
%>
</div>
</table><%end if
rs.close:set rs=nothing
%>
</div>
<%next%> </td>
<td width="34" ></td>
</tr>
</table></td>
</tr>
</table>
js部分:<tr>
<td align="left" valign="top"><table width="740" border="0" cellspacing="0" cellpadding="0">
<tr><%
redim bid(4),btl(4),bpic(4)
for i=1 to 4
bid(i)=0
next
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 4 * from hotelsort where bsortid=1 order by pw_id desc,id desc",conn
if not(rs.eof) then
i=1
while not(rs.eof)
bid(i)=rs("id")
btl(i)=rs("title")
bpic(i)=rs("pic")
i=i+1
rs.movenext
wend
end if
rs.close:set rs=nothing
%>
<td width="164" height="50" rowspan="2"><img src="img/fk_top_left.gif" width="160" height="50" /></td>
<td height="10"></td>
</tr>
<tr>
<td width="575" background="img/fk_top_bg.gif" style="padding-left:3px;">
<div id="xianluMiddle_top">
<ul>
<%
for i=1 to 4
%>
<li class="tab<%if i=1 then
response.Write("1")
else
response.Write("2")
end if
%>" id="m0<%=i%>"><%=lenstr(btl(i),7)%></li>
<%next%>
</ul>
</div> </td>
<td width="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top"><table width="740" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11" height="6"></td>
<td width="200"></td>
<td width="495" height="6"></td>
</tr>
<tr>
<td ></td>
<td align="left" width="200"><img src="img/fk_bz1.jpg" border="0"/></td>
<td align="left" valign="top" style="padding-left:4px;">
<%for i=1 to 4%>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from hotel where bsortid=1 and sortid="&bid(i)&" order by pw_id desc,id desc",conn
if not(rs.eof) then
title=rs("title")
other=rs("other")
%>
<div id="c0<%=i%>" <%if i>=2 then response.Write("style='display:none;'") end if%>>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="right"><a href="111.asp"><img src="img/fk_yuyue.jpg" width="108" height="40" border="0"/></a>
</td>
<tr>
<tr>
<td width="153"><a href="bz.asp?bsortid=1&sortid=<%=bid(i)%>"><img src="pic/hotelsort/<%=bpic(i)%>" width="115" height="150" class="newbord2" border="0" alt="<%=btl(i)%>"/></a></td>
<td width="16"></td>
<td width="322" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" height="50" valign="middle"> <a href="show.asp?id=<%=rs("id")%>" title="<%=title%>" class="menu4"><%=lenstr(title,16)%></a></td>
</tr>
<tr>
<td align="left" valign="top" class="font7" style="border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: #c9c9c9; padding-bottom:5px;"><%=lenstr(other,125)%><a href="show.asp?id=<%=rs("id")%>" class="menu5">[详细]</a></td>
</tr>
</table> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="1" style="margin-top:5px;">
<div id="bfzl"> <%
while not(rs.eof)
title=rs("title")
%>
<div id="bfzl_bt"><img src="img/ico2.gif" width="5" height="5" />
<a href="show.asp?id=<%=rs("id")%>"><%=lenstr(title,18)%></a></div>
<%
rs.movenext
wend
%>
</div>
</table><%end if
rs.close:set rs=nothing
%>
</div>
<%next%> </td>
<td width="34" ></td>
</tr>
</table></td>
</tr>
</table>

function scrollDoor(){
}
scrollDoor.prototype = {
sd : function(menus,divs,openClass,closeClass){
var _this = this;
if(menus.length != divs.length)
{
alert("菜单层数量和内容层数量不一样!");
return false;
}
for(var i = 0 ; i < menus.length ; i++)
{
_this.$(menus[i]).value = i;
_this.$(menus[i]).onmouseover = function(){
for(var j = 0 ; j < menus.length ; j++)
{
_this.$(menus[j]).className = closeClass;
_this.$(divs[j]).style.display = "none";
}
_this.$(menus[this.value]).className = openClass;
_this.$(divs[this.value]).style.display = "block";
}
}
},
$ : function(oid){
if(typeof(oid) == "string")
return document.getElementById(oid);
return oid;
}
}
window.onload = function(){
var SDmodel = new scrollDoor();
SDmodel.sd(["m01","m02","m03","m04"],["c01","c02","c03","c04"],"tab1","tab2");
SDmodel.sd(["n01","n02","n03","n04"],["d01","d02","d03","d04"],"tab1","tab2");
SDmodel.sd(["h01","h02","h03","h04"],["e01","e02","e03","e04"],"tab1","tab2");
SDmodel.sd(["j01","j02","j03","j04"],["f01","f02","f03","f04"],"tab1","tab2");
SDmodel.sd(["k01","k02","k03","k04"],["g01","g02","g03","g04"],"tab1","tab2");
new Youa("box");
}
是浏览器兼容问题?就这段代码上传到不同服务器空间,有的可以,有的不行?为了看效果,我要给两个地址,不是广告}
scrollDoor.prototype = {
sd : function(menus,divs,openClass,closeClass){
var _this = this;
if(menus.length != divs.length)
{
alert("菜单层数量和内容层数量不一样!");
return false;
}
for(var i = 0 ; i < menus.length ; i++)
{
_this.$(menus[i]).value = i;
_this.$(menus[i]).onmouseover = function(){
for(var j = 0 ; j < menus.length ; j++)
{
_this.$(menus[j]).className = closeClass;
_this.$(divs[j]).style.display = "none";
}
_this.$(menus[this.value]).className = openClass;
_this.$(divs[this.value]).style.display = "block";
}
}
},
$ : function(oid){
if(typeof(oid) == "string")
return document.getElementById(oid);
return oid;
}
}
window.onload = function(){
var SDmodel = new scrollDoor();
SDmodel.sd(["m01","m02","m03","m04"],["c01","c02","c03","c04"],"tab1","tab2");
SDmodel.sd(["n01","n02","n03","n04"],["d01","d02","d03","d04"],"tab1","tab2");
SDmodel.sd(["h01","h02","h03","h04"],["e01","e02","e03","e04"],"tab1","tab2");
SDmodel.sd(["j01","j02","j03","j04"],["f01","f02","f03","f04"],"tab1","tab2");
SDmodel.sd(["k01","k02","k03","k04"],["g01","g02","g03","g04"],"tab1","tab2");
new Youa("box");
}