Setting field size for certain browsers - TechRepublic
General discussion
May 31, 2000 at 09:09 AM
kirkk

Setting field size for certain browsers

by kirkk . Updated 26 years ago

Netscape Navigator displays textfields much longer than other browsers. So I need to determine which browser is being used, then set the size accordingly. I have the following javascript function:

function fieldLength()
{
if navigator.appName== “Netscape”
return 20;
else
return 40;
}

Now I need to plug the value into an input tag somehow:

I’ve tried “javascript:fieldLength()” and document.write(fieldLength()) invarious syntaxes, but can’t find the right solution. How can I make this work?

This discussion is locked

All Comments