vForums Support > Programming & Coding :: Database of Codes/Hacks/Mods :: > Smiley & UBBC Drop Down

Smiley & UBBC Drop Down - Posted By Michael (wrighty) on 16th Mar 08 at 10:02am
This simple combines the Smiley Drop Down and UBBC Drop Down codes into one simple nice code.

<script>
/*Smiley & UBBC Drop Down.
Coded By Wrighty
No Ripping, Reposting or Claiming*/

function _do(x, y){
    var w_ub = [];
    var c_ub = [];
    var i_ub = get(x,'id').firstChild.getElementsByTagName('A');
    var d_ub = document.createElement('SELECT');
    d_ub.options[0] = new Option(y, null, null, null);
    d_ub.onchange = function() {
        eval(this.options[this.options.selectedIndex].value);
    }
    for (i=i_ub.length-1;i>= 0;i--) {
        c_ub.push(i_ub[i].getAttribute('onClick'));
        w_ub.push(i_ub[i].getElementsByTagName('IMG').item(0).alt) ;
        i_ub[i].parentNode.removeChild(i_ub[i]);
    }
    for (i=0;i<w_ub.length;i++) {
        d_ub.options[d_ub.options.length] = new Option(w_ub[i], c_ub[i], null, null);
    }
    get(x,'id').replaceChild(d_ub, get(x,'id').firstChild);
}

if (get('smilies_buttons','id')){
    _do('smilies_buttons','Smilies');
}
if (get('ubbc_buttons','id')){
    _do('ubbc_buttons','UBBC Tags');
}

</script>


Global Footer