variabalize a function ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Peuplarchie
Forum Contributor
Posts: 148
Joined: Sat Feb 04, 2006 10:49 pm

variabalize a function ?

Post by Peuplarchie »

Good day to you all,
I'm working on a color picker in javascript and css.
I have found a script that works, but my problem it is made to choose only 1 color, how can I make my code to work for 5.

I know that php is a server-side language, but I think I could be able to modify my code in that sense.

Here is my code :

Code: Select all

 
 
<!--Sample DIV to show selected color -->
 
<div id="colorbox" style="width: 100px;  border: 1px solid gray; padding: 10px; background-color: #F1FFCC">
<br />
 
</div>
 
<br/>
 
<div id="colorbox1" style="width: 100px;  border: 1px solid gray; padding: 10px; background-color: #F1FFCC">
<br />
 
</div>
<br/>
<div id="colorbox2" style="width: 100px;  border: 1px solid gray; padding: 10px; background-color: #F1FFCC">
<br />
 
</div>
<br/>
<div id="colorbox3" style="width: 100px;  border: 1px solid gray; padding: 10px; background-color: #F1FFCC">
<br />
 
</div>
<br/>
<div id="colorbox4" style="width: 100px;  border: 1px solid gray; padding: 10px; background-color: #F1FFCC">
<br />
 
</div>
 
 
<script type="text/javascript">
 
 
 
//*** CUSTOMIZE mkcolor() function below to perform the desired action when the color picker is being dragged/ used
 
//*** Parameter "v" contains the latest color being selected
 
function mkColor(v){
 
//** In this case, just update DIV with ID="colorbox" so its background color reflects the chosen color
 
$S('colorbox').background='#'+v;
 
}
 
 
 
loadSV(); updateH('F1FFCC');
 
 
 
</script>
 
Thanks !
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: variabalize a function ?

Post by andyhoneycutt »

Your post is a bit ambiguous as to what you're asking us to resolve. Also, this should be under the javascript forum.

-Andy
Post Reply