Javascript differences between Firefox and IE
What are the differences between Javascript in Firefox and Internet Explorer?
Have a script that works in Firefox BUT not in Internet Explorer?
Common reasons
- you used t1 instead of document.getElementById(’t1′)
Firefox is somehow able to recognize the t1… whereas IE takes scope into consideration so use
document.getElementById(’whatever’) and make sure the id matches the property
<input type=”button id=”whatever” name=”whatever” />
it appears name is optional :-)… I just have a habit of putting it in.
- You index a String as an array
Firefox supports array indexing of strings
For example,
in firefox
if you had:
var s=”cool”
s=s[0]+s
you would get “ccool”
but in IE:
var s=”cool”
s=s[0]+s
you would get “undefinedcool”
it concatenates “undefined” that s[0] is.. with s which is “cool”
why? How do you fix it?
USE StringName.charAt(index) instead of StringName[index]
var s=”cool”
s=s.charAt[0]+s
Well I explained it nicely..so if you want to summarize again … read on..otherwise move on to another great post
and maybe comment if this was useful to you etc.
1)IE doesn’t handle indexing of strings.. without the use of the function call to
charAt..
whereas firefox DOES handle that..
I suppose you could override charAt for compatability?
2) IE has more trouble with document.getElementById(’t2′)
in firefox it looks like you can say ‘t2′ and it will know what you mean..
3) not sure for charAt if its an array or string?
often the CONTEXT can help A LOT
tempA[before++]=a[start]+b.charAt(q)
Note:
DO NOT TRY:
b.charAt[q]
because I am pretty sure it won’t work… you would only try that if you are lazy I gues.


Leave a Reply
You must be logged in to post a comment.