站内搜索
分类列表
本类阅读排行
本类推荐文章
- ASP技巧:让Len,Left,Right函数识...
- 用ASP实现IE地址栏参数的判断
- 如何实现ASP.NET网站个性化
- 如何在Asp.net中使用HtmlArea编辑...
- 用ASP.Net实现在线压缩和解压缩
- ASP实现不存在的网页就自动发送邮...
- 用ASP取出HTML里面的图片地址的函...
- asp.net跳转页面的三种方法比较
- 一个Winsock组件
- 用WinSock设计Chat程序(转)
- 在MFC应用中深入定制WebBrowser控...
- 这几天有人问关于编应.dll的问题,...
- 在Visual J++中编写ASP COM组件(转...
- 一个显示Grid的VBScript对象
- 好东西,快来看呀:(转载自中华网...
广告
Creating Dynamic Cascading Style Sheets with ASP
作者: 来源: 点击: 日期:2007-3-18 23:32:30
The ASP page dynastyle.asp can now create the correct properties of the style sheet rules dynamically based on the querystring value. For this article, I decided to make the code for dynastyle.asp fairly simple - the style sheet contents are simply hard-coded in. A more flexible solution, though, would be to have the style sheet values pulled from a database. The code for dynastyle.asp can be seen below:
<%@ LANGUAGE=VBSCRIPT %>
<%Option Explicit%>
<%
Dim cardtype, light_color, dark_color, cardimage
'Read in the querystring value
cardtype = request.querystring("cardtype")
'Set our stylesheet values based on the
'querystring value passed in
select case cardtype
case "gold"
light_color = "gold"
dark_color = "navy"
cardimage = "goldcard.gif"
case "platinum"
light_color = "silver"
dark_color = "green"
cardimage = "platinumcard.gif"
case "standard"
light_color = "#ddffdd"
dark_color = "#339933"
cardimage = "standardcard.gif"
end select
%>
h2 { FONT-FAMILY: Arial; FONT-STYLE: italic;
COLOR: <%= dark_color %> }
li {LIST-STYLE-IMAGE: URL("<%= cardimage %>");}
table.transactions{BACKGROUND-COLOR:<%= light_color %>;
COLOR:<%= dark_color %>;
BORDER: THICK DOUBLE <%= dark_color %>;}
.reverse{BACKGROUND-COLOR:<%= dark_color %>;
COLOR:<%= light_color %>;}
That's all there is to it. Other triggers, such as cookies and session variables, can also be used to vary the style sheet content from one user to another.
Creating Dynamic Cascading Style Sheets with ASP 评论
