VB icon

ASP/CSS Drop-down

Email
Submitted on: 1/5/2015 7:59:00 AM
By: LoKi-ZA (from psc cd)  
Level: Beginner
User Rating: By 8 Users
Compatibility: ASP (Active Server Pages), HTML, VbScript (browser/client side)
Views: 963
 
     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! *added (27/06/2K) - This assumes that you have a connection already and you'll have to customise a bit of the code for yourself. Any probs or if you want more of the same code, mail me (darrynb@digitalmall.com) - if you like the code then vote for me!*
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: 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! *added (27/06/2K) - This assumes that you have a connection already and you'll have to customise a bit of the code for yourself. Any probs or if you want more of the same code, mail me (darrynb@digitalmall.com) - if you like the code then vote for me!*
' By: LoKi-ZA (from psc cd)
'
' Inputs:value from the drop down through a form
'
' Assumes:This is a very basic version, it can easily be made better. With a little work that is!
'**************************************

<%'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>
<%'any queries (or stuff-ups) pls mail me!


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.