Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Raising Young Coders: A Parent’s Guide to Teaching Programming at Home
this week in the
General Computing
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Paul Clapham
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Saloon Keepers:
Tim Holloway
Carey Brown
Roland Mueller
Piet Souris
Bartenders:
Forum:
HTML Pages with CSS and JavaScript
null or not an object error in IE works perfectly in Firefox
Phoebe Song
Ranch Hand
Posts: 59
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have a method which works fine in FF, however in IE, I get a null or not an object error. Here is the code, IE complain about parameter lp which I pass value from another method.
function doLoadDictionary(word,lp,U){ var X = !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(); X.open('GET', U, true ); X.onreadystatechange=function(){ if (X.readyState == 4){ if (X.status == 200) { if(U!=null){ xmlDoc=X.responseXML; var eng = xmlDoc.getElementsByTagName("english"); for(var i=0;i<eng.length;i++){ if(word== eng[i].childNodes[0].nodeValue.toUpperCase()){ slang = word; var lang = xmlDoc.getElementsByTagName(lp.toLowerCase()); tlang = lang[i].childNodes[0].nodeValue; break; } } slang == undefined?(document.dictionary.english.value =''):(document.dictionary.english.value =slang); tlang == undefined?(document.dictionary.target.value =''):(document.dictionary.target.value =tlang); } } } } X.send(''); }
>
Bear Bibeault
Sheriff
Posts: 67756
173
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Which line?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Phoebe Song
Ranch Hand
Posts: 59
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
line 13, lp.toLowerCase(), IE complains lp is null or not an object.
Bear Bibeault
Sheriff
Posts: 67756
173
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
So what
is
lp when the error occurs?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Phoebe Song
Ranch Hand
Posts: 59
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
doLoadDictionary function is called by another function, lp is parameter passed from the calling function. Here is the calling function.
function showDictionary(){ var list = document.getElementById("dOption"); var itemName= list.options[list.selectedIndex].value; var langPair = itemName.split("_"); var sl = "English"; var tl = langPair[1]; switch (tl){ case "ar-AR": tl = "Arabic"; break; case "de-DE": tl = "German"; break; case "es-ES": tl = "Spanish"; break; case "fr-FR": tl = "French"; break; case "it-IT": tl = "Italian"; break; case "ja-JP": tl = "Japanese"; break; case "pt-PT": tl = "Portuguese"; break; case "ko-KR": tl = "Korean"; break; case "ru-RU": tl ="Russian"; break; case"zh-CN": tl = "Simplified_Chinese"; break; case "zh-TW": tl = "Traditional_Chinese"; break; } document.getElementById("sl").innerHTML = sl; document.getElementById("tl").innerHTML = tl; doLoadDictionary(this.words,tl,'city.xml'); }
last line calls function doLoadDictionary, lp is a
string
, value is language name.
Phoebe Song
Ranch Hand
Posts: 59
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Any one know what's the problem?
Bear Bibeault
Sheriff
Posts: 67756
173
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You didn't answer my question. What is the value of lp when it fails?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
My javascript code is working only in Internet Explorer
Problem in Parsing XML String
Problem in Parsing XML String
charset and pageEncoding in jsp
Ajax: ResponseXML is null
More...