SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post variabalize a function ?

    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 :
    PHP Code:

    <!--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 !
    Last edited by Peuplarchie; Jul 11, 2009 at 12:24.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •