473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ie7 xml ActiveXObject ErrorMessage: Object expected

Hi all,

My System is windows and ie version is 7.

My code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<script type="text/javsscript">
<!--
var xmlDoc;

function LoadXml(){
if (Web.Application.get_type() ==
Web.ApplicationType.InternetExplorer) {

var progIDs = [ 'Msxml2.DOMDocument.6.0', 'Msxml2.DOMDocument.5.0',
'Msxml2.DOMDocument.4.0', 'Msxml2.DOMDocument.3.0',
'Msxml2.DOMDocument' ];

for (var i = 0; i < progIDs.length; i++) {
try {
xmlDOM = new ActiveXObject(progIDs[i]);
return xmlDoc;
}
catch (ex) {
alert("ex.message");
}
}

return null;
}
}

function ProcessXml(){
if (window.ActiveXObject){
try{
//xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
LoadXml();
xmlDoc.async = false;
xmlDoc.load("url.xml");
}
catch(e)
{
alart(e.message);
}
} else if (document.implementation &&
document.implementation.createDocument){
xmlDoc = document.implementation.createDocument("", "" , null);
xmlDoc.load("url.xml");
//xmlDoc.onload = ShowXml;
} else {
alert("your browser cannot handle the script!");
}

ShowXml();
}

function ShowXml(){
//alert(xmlDoc.getElementsByTagName("url")
[0].childNodes[0].nodeValue);
}
-->
</script>
</head>
<body>
<form action="#">
<input type="button" name="process" id="process"
onclick="ProcessXml()" />
</form>
</body>
</html>

url.xml:
<?xml version="1.0" encoding="utf-8" ?>
<urls>
<url>
<obj>1</obj>
<priority>1</priority>
<loop>3</loop>
</url>
<url>
<obj>1</obj>
<priority>2</priority>
<loop>3</loop>
</url>
<url>
<obj>1</obj>
<priority>3</priority>
<loop>3</loop>
</url>
</urls>

When I click the button, the ie shows an error message "Object
expected". Is there any problem with my code?

Any suggestions would be appreciated!

Thanks!

Apr 27 '07 #1
1 6005
On Apr 27, 3:48 am, JTree <east...@gmail.comwrote:
Hi all,

My System is windows and ie version is 7.

My code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<script type="text/javsscript">
<!--
var xmlDoc;

function LoadXml(){
if (Web.Application.get_type() ==
Web.ApplicationType.InternetExplorer) {

var progIDs = [ 'Msxml2.DOMDocument.6.0', 'Msxml2.DOMDocument.5.0',
'Msxml2.DOMDocument.4.0', 'Msxml2.DOMDocument.3.0',
'Msxml2.DOMDocument' ];

for (var i = 0; i < progIDs.length; i++) {
try {
xmlDOM = new ActiveXObject(progIDs[i]);
return xmlDoc;
}
catch (ex) {
alert("ex.message");
}
}

return null;
}
}

function ProcessXml(){
if (window.ActiveXObject){
try{
//xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
LoadXml();
xmlDoc.async = false;
xmlDoc.load("url.xml");
}
catch(e)
{
alart(e.message);
}
} else if (document.implementation &&
document.implementation.createDocument){
xmlDoc = document.implementation.createDocument("", "" , null);
xmlDoc.load("url.xml");
//xmlDoc.onload = ShowXml;
} else {
alert("your browser cannot handle the script!");
}

ShowXml();
}

function ShowXml(){
//alert(xmlDoc.getElementsByTagName("url")
[0].childNodes[0].nodeValue);
}
-->
</script>
</head>
<body>
<form action="#">
<input type="button" name="process" id="process"
onclick="ProcessXml()" />
</form>
</body>
</html>

url.xml:
<?xml version="1.0" encoding="utf-8" ?>
<urls>
<url>
<obj>1</obj>
<priority>1</priority>
<loop>3</loop>
</url>
<url>
<obj>1</obj>
<priority>2</priority>
<loop>3</loop>
</url>
<url>
<obj>1</obj>
<priority>3</priority>
<loop>3</loop>
</url>
</urls>

When I click the button, the ie shows an error message "Object
expected". Is there any problem with my code?
Can you trim this HTML to about 15 lines and still reproduce the
problem?

Peter

Apr 27 '07 #2

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

Similar topics

4
by: Bill | last post by:
I call a function in my .js file like this: onClick="location.href='blank.html' + generateSearchStringFromForm('section')" where section is the name of my form. The function is defined as...
3
by: undercups | last post by:
When I run page I immediatley get "Object expected" message and the tag <body onload="setfocus()" is highlighted. The error occurs in this snippet from within the script file function...
11
by: westplastic | last post by:
This one is driving me insane. The script works perfect on Firefox, but Internet Explorer keeps complaining about "Error Object Expected" and stuff like that. I've run it through Firefox's Java...
4
by: loserdude84 | last post by:
Hi I keep getting the good old error 'Object Expected Error' on a site I recently built. I am really struggling with this one. Object Expected Error Line 66 <div...
1
nmm32
by: nmm32 | last post by:
I am trying to use Ajax with JSP to populate a 2nd drop down list based on the chosen option of the first one. I am getting the error "Object Expected" on the line 13-14 of the HTML: <script...
1
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a...
5
by: Diego Ruiz | last post by:
Hi!! my english is not too good, but i'll try it I have a javascript code: function executeCommands(inputparms) { // Instantiate the Shell object and invoke its execute method. ...
2
by: thj | last post by:
Hi. I've got this form that I'm trying to validate: <form id="periodForm" action="" method="post"> <p> Periode: <input id="startDate" name="startDate" type="text" size="7" value="<%=...
5
renji1981
by: renji1981 | last post by:
Hi Pals Im getting Object Expected Error and Im new to Ajax . I have pasted the Html code here .. please help . <html> <head> <title>My first ajax Application </title> <script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.