Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


Shital Palve
CSS Apply
1 Answer(s)      3 years and 4 months ago
Posted in : Struts


How can I apply different CSS to my application for background by taking CSS list in Select tag i.e. Combo box. for e.g As in Orkut we select theme & by clicking to apply it changes background theme & color but data is same plz give me solution and respective code for that


Advertisement
View Answers

July 30, 2011 at 10:00 PM


Create two html pages and 3 different style sheets.. below is list of all files..

but it can be done in php... download wampserver from www.wampserver.com it will be installed in c:\wamp drive go in c:\wamp\www paste all files in www folder.. now start wampserver from start and go to browser and write following address--localhost/themes.php

/themes.php/

<form name="mytheme" action="selection.php" method="post">

<select name="themes">
<option value="default">Default</option>
<option value="red">Red</option>
<option value="green">Green</option>
</select>
<input type="submit" value="Apply">
</form>



/*selection.php*/
<html>
<head>

<?php
$themes=$_POST['themes'];

if($themes=='default')
{
echo '<link rel="stylesheet" type="text/css" href="default.css">';
}
else if($themes=='red')
{
echo '<link rel="stylesheet" type="text/css" href="red.css">';
}
else
{
echo '<link rel="stylesheet" type="text/css" href="green.css">';
}


?>
</head>
<body>
hi..
</body>
</html>


/*default.css*/
body
{
background-color:lavender;
}




/*red.css*/
body
{
background-color:red;
}



/*green.css*/
body
{
background-color:green;
}


Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com