Displaying Source Code(s)
|
|
ASP/CSS Drop-down
--------------------------------------------------------------------------------
Description : This code creates a CSS drop-down (small text/colours
- whatever) that pulls values from a DB. It also validates the
browser to check for CSS compatability. Can be nicely adapted
for any site! This assumes that you have a connection already
and you will have to customise a bit of the code for yourself.
<%'To check the browser capabilities this goes above everything
Function checkbrowser
Set check = Server.CreateObject("MSWC.BrowserType")
If check.browser="IE" And check.version >= "4.0" Then
checkbrowser = "DropStyle"
Else
checkbrowser = ""
End If
End Function
'this goes in the head. very basic CSS
%>
<style>
<!--
.DropStyle {font-family: verdana;
font-size: 8pt;
font-weight: normal;
color: black;
width:144;
}
-->
</style>
<%'This drop-down assumes that you have the conn 2 the database
Set up and you've build a RS.
%>
<TABLE>
<TR>
<TD colspan="1" bgcolor=#66C299 align="center">
<FONT face="verdana" size=1>
<Select name="theme" Class="<%=CheckBrowser%>">
<Option value="">Select a theme</Option>
<Option value="">-----------------</Option>
<%if Not rs.eof Then
Do until rs.eof
Response.Write("<OPTION value='" & Trim(rs("name")) & "'>" &
Trim(rs("name")) & "</OPTION>")
rs.Movenext
Loop
End if%>
</FONT></Select>
</TD>
</TR>
</TABLE>
|
|
|