• Post Reply Bookmark Topic Watch Topic
  • New Topic

setting a jsp variable to a returned value of a javascript function??  RSS feed

 
Tex Abrey
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to do this? fCheckNav checks the browser being used and returns a 10 for netscape versions less that 6 or 20 netscape versions 6 or greater and IE. The returned number is for the size of a textbox.
<input type="text" name="author" size="javascript:fCheckNav();"><font size="2">
if not possible how about setting a jsp variable to a javascript function like this:
int iSize = javascript:fCheckNav();
After setting the jsp variable i could use that to define the size of the text box depending on what browser the user is using.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TexAbrey
first, your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
To set the size of the text box in javascript you can set it like this:
document.formName.textBoxID.size=4;
You can't set a jsp variable to a value calculated in client side javascript because is allready evaluated before it sent to the client and the javascript is done after it gets there.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!