473,769 Members | 6,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array handling in Mozilla/Firefox

I'm programming a JS tile map editor for my friend's game. The map
editor has different "sections" that contain different tiles. The way
that it works is when you select a section it calls a JS function that
changes the src of a script tag that contains the array of tiles for
that section, then reloads the tile selection table. This works great
in IE, but Mozilla/Firefox doesn't update the array when I switch JS
files. I've tried putting a function in the JS file that would be
called when the file is switched, but this doesn't work either, so I
think that Moz/FF caches arrays when the page loads. Any ideas?

Jul 23 '05 #1
4 1804


ek*********@hot mail.com wrote:
The way
that it works is when you select a section it calls a JS function that
changes the src of a script tag that contains the array of tiles for
that section, then reloads the tile selection table. This works great
in IE, but Mozilla/Firefox doesn't update the array when I switch JS
files. I've tried putting a function in the JS file that would be
called when the file is switched, but this doesn't work either, so I
think that Moz/FF caches arrays when the page loads. Any ideas?


Mozilla doesn't load a new script if you change the src of a <script>
element, you need to create a new <script> element, set its src and then
insert the element into the page if you want to load a new script. Also
note that loading might happen asynchronously so that you need to attach
an event listener to the load event.
Here is an example made in response to a post some days ago in the
Mozilla DOM newsgroup:
http://home.arcor.de/martin.honnen/j...t20040701.html
That has been tested to work with Netscape 7.1 and Firefox 0.9.
Loading scripts dynamically doesn't work with older Mozilla version but
I can't tell the exact version it was implemented, do some tests
yourself if you want to rely on that feature.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2
Martin Honnen wrote:


<--snip-->
Here is an example made in response to a post some days ago in the
Mozilla DOM newsgroup:
http://home.arcor.de/martin.honnen/j...t20040701.html
That has been tested to work with Netscape 7.1 and Firefox 0.9.
Loading scripts dynamically doesn't work with older Mozilla version but
I can't tell the exact version it was implemented, do some tests
yourself if you want to rely on that feature.


The title says IE5.5/6.0 Win but I do not get the loaded alert in IE6.0
on WinME.

I saved it locally, added my own JS file with an alert, and I get the
alert from the .js file, just not from the .html page.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/
Jul 23 '05 #3


Randy Webb wrote:
Martin Honnen wrote:
Here is an example made in response to a post some days ago in the
Mozilla DOM newsgroup:
http://home.arcor.de/martin.honnen/j...t20040701.html
That has been tested to work with Netscape 7.1 and Firefox 0.9.
Loading scripts dynamically doesn't work with older Mozilla version
but I can't tell the exact version it was implemented, do some tests
yourself if you want to rely on that feature.

The title says IE5.5/6.0 Win but I do not get the loaded alert in IE6.0
on WinME.


Sorry for the confusion, in the other newsgroup the guy asked how to do
it with Mozilla/Netscape, I then intended to write a cross browser (well
IE and Mozilla and any other browser firing load or onreadystate events)
way using an event handler thus I gave it that title but in that thread
http://groups.google.com/groups?hl=e...%26scoring%3Dd
I mainly focussed on a Mozilla solution and didn't look further why IE
refuses to fire the event handler.
I might look into that later.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #4


Randy Webb wrote:
Martin Honnen wrote:
Here is an example made in response to a post some days ago in the
Mozilla DOM newsgroup:
http://home.arcor.de/martin.honnen/j...t20040701.html
That has been tested to work with Netscape 7.1 and Firefox 0.9.
Loading scripts dynamically doesn't work with older Mozilla version
but I can't tell the exact version it was implemented, do some tests
yourself if you want to rely on that feature.

The title says IE5.5/6.0 Win but I do not get the loaded alert in IE6.0
on WinME.


I have now looked into that and as tested with IE6 here the onreadystate
event is fired but unfortunately the sequence of readyState values is
different on different occasions, it doesn't always reach the readyState
value 'complete' that the above page checks for but sometimes stops with
the readyState value 'loaded'. It seems to depend on whether the script
file is loaded from cache or not, at least that is one influencing
factor I could determine.
If the script is changed to check the variable when
readyState == 'loaded' || readyState == 'complete'
then at least with that short script file the variable is always defined
so for the time being I have made the following test case:
http://home.arcor.de/martin.honnen/j...004070401.html
that seems to solve the problem for IE5.5/6 on Windows.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

111
14430
by: Retlak | last post by:
The recommended (on dozens of websites) and effective (works in Netscape, MSIE, Mozilla, probably others) way to detect if a browser has Javascript turned off is to put this in the <head>: <noscript> <meta http-equiv="refresh" content="1;url=http://yourURL/nojscript.html"> </noscript> This redirects to a doc which typically says "You need to enable
4
2546
by: John Bullock | last post by:
Hello, I am at wit's end with an array sorting problem. I have a simple table-sorting function which must, at times, sort on columns that include entries with nothing but a space (@nbsp;). I want all of the spaces to be put in the first slots of the array. IE 6 does this. But Firefox 0.9.1 doesn't, and I don't know why. I have not been able to reproduce it in very simple form (which is itself a puzzle). But example code is...
3
3995
by: gambler | last post by:
let's say you have: var games = new Array(); games = new GAME(gameNum, rotNum1, rotNum2, ... ); ( so a sparsley populate array which enables me to locate a game usin the game number without having to implement a "search" function on th games array
35
6666
by: VK | last post by:
Whatever you wanted to know about it but always were affraid to ask. <http://www.geocities.com/schools_ring/ArrayAndHash.html>
10
2376
by: News | last post by:
I have a page up trying to learn how to ID a browser and other info. http://wyght.com/warren/testPos.html here is the code <script type = "text/javascript"> var space = ", "; var name = navigator.appName;
3
4232
by: yehaimanish | last post by:
I am developing an application by which to parse the content from the access_log and insert it into the database. Since each row is an different entry, I am using file() to get the contents into an array and manipulate each row by foreach(...) and insert/update in the database accordingly. If the file is small, it works well. If the file is large (say > 5mb), it generates memory allocation error. However I came to know that the allowed...
45
4858
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b> as an option) As that is not in relevance to "new Array() vs " question or to the array performance, I dared to move it to a new thread. Gecko takes undefined value strictly as per Book 4, Chapter 3, Song 9 of Books of ECMA :-)
13
1963
by: David Golightly | last post by:
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and messing around with it in the console, working through some of the exercises given at http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7 Looks like the "version" function isn't supported, at least not in the Firefox console. So many of the new features - especially using the "let" and "yield" keywords, as well as practical Array comprehensions which depend on...
3
8921
by: rupinderbatra | last post by:
Hello everyone, I am using a regular expression to parse a text string into various parts -- for ex: string "How do you do" will be changed to array with all the words and white spaces. I am using the following code (which has been copied from internet) <html> <body> <script type="text/javascript">
0
9590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.