Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

oh no! how set color ?

Javascript coding ..

Moderators: macek, egami, gesf

oh no! how set color ?

Postby sarjanajava » Tue Jan 04, 2005 10:26 pm

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
User avatar
sarjanajava
New php-forum User
New php-forum User
 
Posts: 41
Joined: Wed Nov 27, 2002 10:59 pm

Postby G3D » Wed Jan 05, 2005 3:29 am

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";
}
G3D
New php-forum User
New php-forum User
 
Posts: 21
Joined: Sun Oct 10, 2004 9:10 am

Postby Oleg Butuzov » Wed Jan 05, 2005 6:10 am

why not use css, or javascript?

i am not see here any connection to PHP.

moved to javascript.
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby sarjanajava » Wed Jan 05, 2005 8:57 am

G3D 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";
}


.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 then
Code: Select all
setcolor.php?cl=blue


[/code]
User avatar
sarjanajava
New php-forum User
New php-forum User
 
Posts: 41
Joined: Wed Nov 27, 2002 10:59 pm

Re: oh no! how set color ?

Postby WebOutGateway » Sun Aug 03, 2014 6:34 pm

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.
User avatar
WebOutGateway
New php-forum User
New php-forum User
 
Posts: 36
Joined: Mon Jun 13, 2011 9:25 pm
Location: Pasig City, Philippines


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron