function _setValue( sNewValue ) { obj = this.getObj(); nOptions = obj.options.length; for ( iO = 0; iO < nOptions; iO++ ) { oO = obj.options[iO]; if ( oO.value == sNewValue ) { oO.selected = true; } else { oO.selected = false; } } } function _getValue() { obj = this.getObj(); i = obj.selectedIndex; if ( i == -1 ) { return null; } else { return obj.options[i].value; } } function _getObj() { if ( null != this.obj ) { return this.obj; } nForms = document.forms.length; for ( nF = 0; nF < nForms; nF++ ) { oF = document.forms[nF]; nElements = oF.elements.length; for ( nE = 0; nE < nElements; nE++ ) { oE = oF[nE]; if ( oE.name == this.id ) { this.obj = oE; return oE; } } } return null; } function netscape_peas_select_OnChange( oElement ) { oJS = window[oElement.name]; if ( null != oJS.onChange ) { oJS.onChange( "value", null, oJS.getValue() ); } } function netscape_peas_select_OnBlur( oElement ) { oJS = window[oElement.name]; if ( null != oJS.onBlur ) { oJS.onBlur(); } } function netscape_peas_select_OnFocus( oElement ) { oJS = window[oElement.name]; if ( null != oJS.onFocus ) { oJS.onFocus(); } } function netscape_peas_select_client( params ) { this.getObj = _getObj; this.setValue = _setValue; this.getValue = _getValue; this.id = params.id; if ( null == params.optText ) { params.optText = params.optVal; } if ( null == params.optVal ) { params.optVal = params.optText; } sName = " name='"+params.id+"'"; sSize = " size='"+params.boxSize+"'"; sOnChange = " onchange='netscape_peas_select_OnChange(this)'"; sOnBlur = " onblur='netscape_peas_select_OnBlur(this)'"; sOnFocus = " onfocus='netscape_peas_select_OnFocus(this)'"; sMultiple = ""; if ( null != params.multiple && "" != params.multiple && params.multiple == "true" ) { sMultiple = " multiple"; } document.write( "<select" + sName + sSize + sOnChange + sOnBlur + sOnFocus + sMultiple + ">\n" ); if ( params.optVal != null ) { for ( iIndex = 0; iIndex < params.optVal.length; iIndex++ ) { sDefault = ( null != params.defaultValue && params.defaultValue == params.optVal[iIndex]) ? " SELECTED" : ""; document.write("<option value='"+params.optVal[iIndex]+"'" + sDefault + ">" + params.optText[iIndex] + "\n" ); } } document.writeln( "</select>\n" ); }