vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Database of Codes/Hacks/Mods :: Color Drop Down v1 - View Topic
Topic Rating: *****
Printable View
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Color Drop Down v1 (21st Mar 08 at 9:27pm UTC)
This will add a color drop down to the right of the UBBC buttons. Very handy thing to have! {Smile}

<script>
/*Color Drop Down v1
Created By Wrighty
No Rip, Repost or Claiming*/

var color = {

    list: [
        ["Red","FF0000"],
        ["Green","00FF00"]
    ],

    _s: document.createElement('select'),
    _d: document.createElement('span'),
    _p: get('ubbc_buttons','id'),
    add: {
        colors: function(){
            color._s.options[0] = new Option('Choose Color','');
            for(i=0;i<color.list.length;i++){
                color._s.options[i+1] = new Option(color.list[i][0],color.list[i][1]);
            }
        },
        extra_features: function(){
            color._d.style.paddingLeft = '20px';
            color._s.onchange = function(){
                if(color._s.value!=''){
                    add_ubbc('[color='+color._s.value+']','[/color]');
                }
            };
        },
        drop_down: function(){
            color._d.appendChild(color._s);
            color._p.firstChild.insertBefore(color._d, color._p.firstChild.getElementsByTagName('br')[0]);
        }
    },
    build: function(){
        if(color._p){
            this.add.colors();
            this.add.extra_features();
            this.add.drop_down();
        }
    }
};
color.build();
</script>


To add more colours simply alter the following:

        ["Red","FF0000"],
        ["Green","00FF00"]


To add 'Blue' you would use this:

        ["Red","FF0000"],
        ["Blue","0000FF"],
        ["Green","00FF00"]


Global Footer
Cryhavoc_
Full Member
***

Just do it.

Posts: 238
Status: Offline
Gender: Male
Location: The wrong way.
Age: 31
Joined:  
Reputation: 0%  


pm
Re: Color Drop Down v1 (22nd Mar 08 at 7:09pm UTC)
You got it done eh? {Tongue Out}

Image

Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Color Drop Down v1 (22nd Mar 08 at 8:08pm UTC)
Yup. Was nice and easy! ^_^

All (MOSTLY!) DOM! {Smile}
 Printable View

All times are GMT+0 :: The current time is 3:26am
Page generated in 0.7536 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums