Discussion Locked

Setting field size for certain browsers

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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?

2 replies

by mightyduk

to the best of my knowledge, netscape will not let you resize the text box, however, IE does. So if you set the size initially to the size for netscape, and use this javascript it will check for non netscape browsers and set the appropriate size:

....

This discussion is closed to new replies.