aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes problem with javascript array and undefined values in Internet explorer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "problem with javascript array and undefined values in Internet explorer" Watch "problem with javascript array and undefined values in Internet explorer" New topic
Author

problem with javascript array and undefined values in Internet explorer

Marcel Jacome
Greenhorn

Joined: Feb 06, 2009
Posts: 26
Hi guys, i am facing a big problem concerning javascript and internet explorer. I have been working on a virtual keyboard and everything works fine in all browsers except internet explorer 6 and up. The problem is that the elements of the arrays in my program turn out to be undefined. If i try the same program in a different browser , it works perfectly.
The code is as follows:



Pressing the button labeled "MAYUS." , the program changes the keys' values from lowercase to uppercase and viceversa, but this funcionality does not work in internet explorer.

What can i do to make it work for IE ?

Thanks in advance

Marcel Jacome
Greenhorn

Joined: Feb 06, 2009
Posts: 26
You can copy and paste the code into an html file and run it. The problem lies in these functions



In the code above , the array arr[] exists before entering the for loop, once inside the loop , the elements are undefined.


The same happens here in this function where i am changing an arrays' elements to uppercase



Thanks for your help
Marcel Jacome
Greenhorn

Joined: Feb 06, 2009
Posts: 26
Is there anything to do at all??? Should i use a library like jquery to solve this problem??? are there more options??
Any ideas?? thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Few people are going to red through almost 500 lines of code. You might attract more people to your issue if you pare the problem down to a smaller code fragment and be very precise about what the issue is.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Marcel Jacome
Greenhorn

Joined: Feb 06, 2009
Posts: 26
It was easier than i thought , just used the onfocus method exposed by struts layout and it worked.
Marcel Jacome
Greenhorn

Joined: Feb 06, 2009
Posts: 26
As far as the javascript and the undefined array elements , i just made both arrays global and solved the issue with IE.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with javascript array and undefined values in Internet explorer