这样的效果是怎么样实现的呢?

threezxw 2004-04-12 09:28:07
http://www.ruichen.net/
在这个网站中点击“风格”里面有好多选项可选。
选择其中一项后网页的风格就变了。请教各位大侠这是怎么实现的呢?最好给源码,
谢谢。
...全文
127 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
lonelydreamsym 2004-04-13
  • 打赏
  • 举报
回复
我用的方法是定义多个CSS,然后动态调用就可以了,具体调用哪个可以把CSS的路径存在数据库里。
tzgpxl 2004-04-13
  • 打赏
  • 举报
回复
你需要的不是别人的指点,是需要细心的看动网的论坛代码,看懂了你就懂了,
讲给你听除了告诉你这是用css做的,别的没办法指点了。
还是自己一句一句看吧,这才是捷径,大家都是这么看过来的呢
tzgpxl 2004-04-13
  • 打赏
  • 举报
回复
你需要的不是别人的指点,是需要细心的看动网的论坛代码,看懂了你就懂了,
讲给你听除了告诉你这是用css做的,别的没办法指点了。
还是自己一句一句看吧,这才是捷径,大家都是这么看过来的呢
Aking5018 2004-04-12
  • 打赏
  • 举报
回复
<HTML>
<HEAD>
<style type="text/css">
<!--
.aa {
font-size: 12px;
color: #000000;
text-align: center;
vertical-align: middle;
letter-spacing: 0px;
word-spacing: 0px;
}
body,td,th {
font-size: 12px;
font-family: 宋体;
}
body {
background-color: #dee3f7;
margin-left: 0px;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<body >
<%
dim cn,rs,SQL ,Para,NumChild
dim SD,GD'定义深度广度
set cn=server.CreateObject("ADODB.connection")
set rs=server.createobject("ADODB.recordset")
set rs1=server.createobject("ADODB.recordset")
cn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db.mdb")
SQL="SELECT ID,Name,HyperLink,(len(ID)+1)/2 as SD,RIGHT(ID, 1) AS GD FROM tree order by ID"
rs.open SQL,cn,1,1
do while not rs.EOF
SD=rs("SD")
if SD>5 then SD=5 '深度
GD= asc(rs("GD"))-96
if GD>10 then GD=10 '广度
SQL="Select ID from tree where ID like '" & rs("ID") & "_%' and ID<>'" & rs("ID") & "' order by ID"
Para=rs("ID") & "|"
NumChild=0
rs1.open SQL,cn, 1,1
NumChild=rs1.RecordCount
do while not rs1.EOF
Para =Para & rs1("ID") & "|"
rs1.MoveNext
loop
Para=cstr(trim(left(Para,len(Para)-1)))
rs1.Close
%>
<table id="T<%=rs("ID")%>" border=1 cellpadding=0 cellspacing=0 bordercolor="#DEE3F7" class="aa" abbr="<%=Para%>" summary=<%=checkid(rs("ID"))%> style="cursor:hand" onClick='vbs:subtree "<%=Para%>"' >
<tr>
<td width="<%=17+checkid(rs("ID"))*20%>" height="17" align="right">
<table width="17" height="17" border="1" cellpadding="0" cellspacing="3" bordercolor="#DEE3F7">
<tr>
<td align="center" valign="middle" bordercolor="#000000" id="R<%=rs("ID")%>" style="font-size:9" >
<%if NumChild=0 then Response.Write "." else Response.Write "+"%>
</td>
</tr>
</table>
</td>
<td>
<img width="16" height="16" src="tree/<%=SD%>/<%=GD%>.gif">
</td>
<td height="17" nowrap bordercolor="#FFFFFF" onMouseOver="vbs:me.bgcolor='#CCCCCC':me.bordercolor='#999999'" onMouseOut="vbs:me.bgcolor='#DEE3F7':me.bordercolor='#ffffff'" title="<%=rs("ID")%>" onclick='vbs:window.location.href="<%=rs("HyperLink")%>"'>
<%=rs("Name")%>
</td>
</tr>
</table>
<% rs.MoveNext
loop
rs.Close
cn.Close
set rs=nothing
set rs1=nothing
set cn=nothing

function checkid(x)
checkid=Ubound(split(x,"_"))
end function
%>
</body >
<script language=VBS>
sub subtree(Client_para)
if instr(Client_para,"|")=0 then exit sub
Myarray=split(Client_para,"|")
Mytext=trim(eval("R" & Myarray(0) & ".innertext") )
select case Mytext
case "+"
document.all.item("R" & Myarray(0)).innertext="-"
for i=1 to ubound(Myarray)
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")=1 then
document.all.item("T" & Myarray(i)).style.display="block"
end if
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")>1 then
document.all.item("T" & Myarray(i)).style.display="none"
end if
next
case "-"
document.all.item("R" & Myarray(0)).innertext="+"
for i=1 to ubound(Myarray)
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")>=1 then
document.all.item("T" & Myarray(i)).style.display="none"
if eval("R" & Myarray(i) & ".innertext")="-" then
document.all.item("R" & Myarray(i)).innertext="+"
end if
end if
next
end select
set Myarray=nothing
end sub

Sub document_onselectstart
document.selection.clear
End Sub

if isobject(eval("Ta")) then
subtree document.all("Ta").abbr '一次也不执行为全展开
subtree document.all("Ta").abbr '执行1次为只显示根目录
subtree document.all("Ta").abbr '3次为显示根目录下第一层
end if
</script>
</HTML>
wgd 2004-04-12
  • 打赏
  • 举报
回复
这是将不同的配色方案存入了css中,
点击后写了一个值到cookie或session里
动网论坛就有这个原码
threezxw 2004-04-12
  • 打赏
  • 举报
回复
to aking5018()
老兄你的程序需要数据库阿,说一下你的表需要那些字段,怎么设置好吗。谢谢。我是菜鸟,需要耐心指点了^_^
threezxw 2004-04-12
  • 打赏
  • 举报
回复
to aking5018()
我试试你的先
threezxw 2004-04-12
  • 打赏
  • 举报
回复
to wgd()
能给个具体的例子吗

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧