PDA

View Full Version : Form Select + CSS Styles + N4.x = ERROR!!!


Gordo
08-20-2002, 10:28 AM
Okay, my dropdown select form works just fine in all major browsers. But when I have CSS styles declared, Netscape 4.79 (what I test with) freaks out. WHY? WHY? WHY? The box shows the text of ALL selections (see attachment). You can't choose any of them, and I get the standard error:
JavaScript error: Type 'javascript:' into Location for details


MY CSS:
input, textarea, select, button {
BORDER-STYLE: solid;
BORDER-COLOR: #000080;
BORDER-WIDTH: 1;
FONT-FAMILY: Arial, Helvetica, Verdana;
FONT-SIZE: 10pt;
COLOR: #000080;
BACKGROUND-COLOR: #B5D0E5
}


MY FORM:
<script language="JavaScript">
// used to open dropdown selections below in new browser windows
function go2(formName, popupName, target) {
var popup = document[formName].elements[popupName];
if (popup.options[popup.selectedIndex].value != "") {
window.open(popup.options[popup.selectedIndex].value, target);
popup.selectedIndex=0;
}
}
</script>
<form name="jump1">
Tax Forms<br>
<select name="menu">
<option value="http://www.irs.gov/forms_pubs/forms.html">IRS Tax Search</option>
<option value="http://www.wellsfargo.com/tax_center/preparing/articles/tax_forms.jhtml">Wells Fargo Common Forms</option>
<option value="http://www.window.state.tx.us/m23taxes.html">State of Texas</option>
</select>
<input type="button" onClick="go2('jump1', 'menu', '_blank');" value="GO">
</form>

brothercake
08-20-2002, 10:44 AM
Netscape 4 does not like border styles. What i've done in situations like this is js write the style:

<script>

var sty='';
if(typeof document.layers=="undefined"){
sty+='<style>';
sty+='input \{ border:1px solid red \}';
sty+='</style>';
document.write(sty);

</script>

Gordo
08-21-2002, 09:40 AM
Thanks brothercake. I took the border declaration out my CSS file, and put in your JS. I had to add an extra } at the end (before the </script>, but it now works great.

brothercake
08-21-2002, 10:00 AM
Originally posted by Gordo
I had to add an extra } at the end (before the </script>, but it now works great.

:o