Make JavaScript run on different browsers
<p>I have a script that is working on internet explorer but does not work on Firefox and Chrome. How can i make it work across different browsers? I am trying to add members from one richtextbox to another. Thanks. Here is the script:</p>

<pre><code>&lt;script language="Javascript" type="text/javascript"&gt;

function selectAll() {

    sLength = document.defaultFrm.elements['members[]'].length;
    for (i=0; i&lt;sLength; i++) {
        document.defaultFrm.elements['members[]'].options[i].selected = true;
    }
    /*
    //commented out 05/05/08 Rebecca - no processes element defined
    sLength = document.defaultFrm.elements['processes[]'].length;
    for (i=0; i&lt;sLength; i++) {
        document.defaultFrm.elements['processes[]'].options[i].selected = true;
    }
    */

}

function addMembers(obj,obj2) {
    sLen = obj.length;
    for ( i=0; i&lt;sLen; i++){
        if (obj.options[i].selected == true ) {
            obj2Len = obj2.length;
            obj2.options[obj2Len]= new Option(obj.options[i].text, obj.options[i].value);
        }
    }
    for ( i=(sLen-1); i&gt;=0; i--) {
        if (obj.options[i].selected == true ) {
            obj.options[i] = null;
        }
    }
}
function removeMembers(obj,obj2) {
    sLen = obj2.length;
    for ( i=0; i&lt;sLen ; i++){
        if (obj2.options[i].selected == true ) {
            objLen = obj.length;
            obj.options[objLen]= new Option(obj2.options[i].text, obj2.options[i].value);
        }
    }
    for ( i = (sLen -1); i&gt;=0; i--){
        if (obj2.options[i].selected == true ) {
            obj2.options[i] = null;
        }
    }
}


&lt;/script&gt;
</code></pre>
