File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript stability Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

JavaScript stability

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I defined a global variable in the JS file and let the html page include it. When I use this variable in the html page, it brings error saying the varilable is undefined on some deployed server, but don't show the error on some other deployed servre. Or error comes out in IE but ok in Firefox, or the other way around in different people's PC.

Is this the nature of JS code? Or what could lead to this uncertainty?
Thanks.


SCJA, SCJP5.0, SCBCD, SCWCD
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
Not sure why that happens.. For the errors I fix in js sometimes dont have clue why they work & why not?
JS depends on many things like what browser you are using and its version also on browser settings.. etc..
Thats why we should use JS as less as possible in our validations.
If you need to fix the problem very quickly, you can use hidden control to store the value and access that control to get back the value and manipulate. Only disadvantage i see in using hidden control is the control value will be submitted to server.


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I answered this same question of your somewhere else.

Make sure you are not declaring it after you already use it.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript stability