Ask the Expert

My JS fails after line 1. What am I doing wrong?

I am using Mozilla and I am writing a js (see below) and I am trying to load an XML file using DOM. However, the js fails after Line 1. It shows alert C1 on screen, never shows alert C2. What am I doing wrong?

function search() { 
   var oMystuff = new ActiveXObject("Microsoft.XMLDOM") 
// Line 1 
   alert("C2"); // Line 2 
   oMyStuff.load ('posters.xml'); 

    Requires Free Membership to View

Missing semi-colon on the line that creates an ActiveXObject. Failing that, something causing the browser to fail to create an XMLDOM sucessfully. You need to turn on javascript debugging and take a closer look at the error produced.

This was first published in October 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: