home |   sample code |   components |   books |   tutorials |   links |   downloads |   hosts | donations | jobs and training | news headlines | Search the net | Newsletter | Contact us
Change background color based on users choice

In this example we will create 2 pages , on the first page we have a text box and a submit button . The user enters a valid color (e.g azure , blue , silver , gold ) and this is then sent to the second ASP page where the information is processed and added to the <body> tag .

Here is the first page .

<form>
Background Color selector
<form action ="backcolor.asp" method="post">
Please type in a valid color e.g blue , green , yellow
<input type="text" name ="backcolor"><p>
<input type="submit" value="submit"><p>
</form>

Now save this as bgselector.asp and now here is the code for the second page .

<%
Dim strBackColor
strBackColor = Request.Form("backcolor")
%>

Now save this as backcolor.asp . Now test all this out by entering a color in the text box and clicking on submit . Then the backcolor.asp will show the color.

 

Sponsors

|