anybody know how to set color according to selection button: red, the interface change to red,blue:..to blue, for example this site:
http://www.promosi-web.com
oh no! how set color ?
Moderators: egami, macek, gesf
- sarjanajava
- php-forum Active User
- Posts: 39
- Joined: Wed Nov 27, 2002 10:59 pm
- Contact:
You just change the style sheet based on the selection.
This site actually has five versions of the images and the page is just loading an image based on what $cl is currently set to.
You could for example load the relevant logo with the following, not saying this is the best approach, just an example.
This site actually has five versions of the images and the page is just loading an image based on what $cl is currently set to.
You could for example load the relevant logo with the following, not saying this is the best approach, just an example.
Code: Select all
if(isset($cl)) {
$image = "logo_" . $cl . ".gif";
} else {
$image = "logo_blue.gif";
}
-
- Last Samuray
- Posts: 824
- Joined: Sun Jun 02, 2002 3:09 am
why not use css, or javascript?
i am not see here any connection to PHP.
moved to javascript.
i am not see here any connection to PHP.
moved to javascript.
- sarjanajava
- php-forum Active User
- Posts: 39
- Joined: Wed Nov 27, 2002 10:59 pm
- Contact:
.which means that i have to create one file namely setcolor.php then include this code for color selection?, how to assign color button relatively according to this coding to make sure when blue was press thenG3D wrote:You just change the style sheet based on the selection.
This site actually has five versions of the images and the page is just loading an image based on what $cl is currently set to.
You could for example load the relevant logo with the following, not saying this is the best approach, just an example.
Code: Select all
if(isset($cl)) { $image = "logo_" . $cl . ".gif"; } else { $image = "logo_blue.gif"; }
Code: Select all
setcolor.php?cl=blue
- WebOutGateway
- php-forum Fan User
- Posts: 65
- Joined: Mon Jun 13, 2011 9:25 pm
- Location: Pasig City, Philippines
- Contact:
Hi!
You can use jQuery using the click and css methods.
Just set a button or two, depending on the number of colors you want to change into.
Using jQuery, call the button by its id. Upon clicking the button, the function you will create will be executed.
For example, you have a button that will change the color of the paragraph into red.
<p>This will be changed to red.</p>
<button id="toRed">Change text to red.</button>
Then create your script with the following inside:
$(document).ready(function(){
$("#toRed").click(function(){
$("p").css("color","red");
});
});
Just set whatever style you want. In your case, you can set the background-color, I think.
I hope this helps. Thank you.
You can use jQuery using the click and css methods.
Just set a button or two, depending on the number of colors you want to change into.
Using jQuery, call the button by its id. Upon clicking the button, the function you will create will be executed.
For example, you have a button that will change the color of the paragraph into red.
<p>This will be changed to red.</p>
<button id="toRed">Change text to red.</button>
Then create your script with the following inside:
$(document).ready(function(){
$("#toRed").click(function(){
$("p").css("color","red");
});
});
Just set whatever style you want. In your case, you can set the background-color, I think.
I hope this helps. Thank you.
hi,
CSS solution (CSS3):
HTML:
<input type="radio" name="1" value="100" id="a1">
<label for="a1" class="radiostyle">100 bucks</label>
CSS:
.radiostyle
{
background-color: #999;
}
input[type=radio]:checked+label
{
/* Or `#a1:checked+label` if you only want it for that input */
background-color: red;
}
CSS solution (CSS3):
HTML:
<input type="radio" name="1" value="100" id="a1">
<label for="a1" class="radiostyle">100 bucks</label>
CSS:
.radiostyle
{
background-color: #999;
}
input[type=radio]:checked+label
{
/* Or `#a1:checked+label` if you only want it for that input */
background-color: red;
}