Background Color Changer
<!--- Set param for background, bg --->
<cfparam name="bg" default="">
<html>
  <head>
    <title>Color Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    </head>

    <body bgcolor=
<cfoutput>"#bg#"</cfoutput>>

<!--- Output the URLEncoded attribute for background color, see below. --->
<h3>Note: this also demonstrates use of <em>URLEncodedFormat</em> and <em>CFParam</em></h3>
<p><br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("green")#</cfoutput>">green</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##eaebf6")#</cfoutput>">#EAEBF6</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##fff5df")#</cfoutput>">#FFF5DF</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##000099")#</cfoutput>">#000099</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##999999")#</cfoutput>">#999999</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##666699")#</cfoutput>">#666699</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##666666")#</cfoutput>">#666666</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##999966")#</cfoutput>">#999966</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##ffffff")#</cfoutput>">#FFFFFF</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##000000")#</cfoutput>">#000000</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##006699")#</cfoutput>">#006699</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##660099")#</cfoutput>">#660099</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##336699")#</cfoutput>">#336699</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##993366")#</cfoutput>">#993366</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##0066cc")#</cfoutput>">#0066CC</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##ccff00")#</cfoutput>">#CCFF00</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##333366")#</cfoutput>">#333366</a>
<br><a href="../../../inetpub/wwwroot/Test/bgcolor_changer.cfm?bg=<cfoutput>#URLEncodedFormat("##666633")#</cfoutput>">#666633</a>

<p>The sky's the limit, so try your own colors.

</body>
</html>

All ColdFusion Tutorials By Author: Bryce
  • Background Color Changer
    Simple list of links to: 1. Change the background color of current page. 2. Demonstrate CFParam and URLEncodedFormat (both of them can be life savers!) 3. Provide hours of fun for the easily amused (I'm guilty as charged).
    Author: Bryce
    Views: 13,830
    Posted Date: Thursday, March 25, 2004
Download the EasyCFM.COM Browser Toolbar!