Object Required

M

Mark Constant

I have a select box in HTML that calls upon a Javascript file.
Whenever I call the Javascript file it says "Object Required" for an
error message. I got it working before but don't remember how.

Here is the drop-down menu that calls the Javascript file
<div id="layer1" name="layer1">
<div align="center"><select name="select1"
onchange='CallXML(this.form.select1, "PS2");'>
<option selected>Please Select a Genre</option>
<option value="All">All</option>
<option value="Fighting">Fighting</option>
<option value="FPS">First Person Shooter</option>
<option value="Platformer">Platformer</option>
<option value="Sports">Sports</option>
<option value="TPA">Third Person Action</option>
</select>
</div>

Here is the Javascript file
function CallXML(dropdown, Hardware)
{
var myIndex = dropdown.selectedIndex;
var SelValue = dropdown.options[myIndex].value;
var xsltTree = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
xsltTree.async = false;
xsltTree.load("Entertainment.xslt");

var srcTree = new ActiveXObject("Msxml2.DOMDocument.4.0");
srcTree.async = false;
srcTree.load("Entertainment.xml");


var xsltThread = new ActiveXObject("Msxml2.XSLTemplate.4.0");
xsltThread.stylesheet = xsltTree;
var xsltProc = xsltThread.createProcessor();
xsltProc.input = srcTree;
xsltProc.addParameter("Genre", SelValue);
xsltProc.addParameter("Hardware", Hardware);

xsltProc.transform();
document.all.layer1.innerHTML = xsltProc.output;
}
 
M

Martin Honnen

Mark said:
I have a select box in HTML that calls upon a Javascript file.
Whenever I call the Javascript file it says "Object Required" for an
error message.

Which browser gives that error message? Which line is given as causing
the error?

<select name="select1"
onchange='CallXML(this.form.select1, "PS2");'>

CallXML(this, "PS2");
should suffice.
function CallXML(dropdown, Hardware)
{
var myIndex = dropdown.selectedIndex;
var SelValue = dropdown.options[myIndex].value;
var xsltTree = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");

This can only work with IE on Windows if MSXML 4 is installed. No IE
version installs that, IE6 only installs MSXML 3.
xsltTree.async = false;
xsltTree.load("Entertainment.xslt");

var srcTree = new ActiveXObject("Msxml2.DOMDocument.4.0");
srcTree.async = false;
srcTree.load("Entertainment.xml");


var xsltThread = new ActiveXObject("Msxml2.XSLTemplate.4.0");
xsltThread.stylesheet = xsltTree;
var xsltProc = xsltThread.createProcessor();
xsltProc.input = srcTree;
xsltProc.addParameter("Genre", SelValue);
xsltProc.addParameter("Hardware", Hardware);

xsltProc.transform();
document.all.layer1.innerHTML = xsltProc.output;
}

Let us know the details, which browser you have tried with, which line
is causing the errror, whether MSXML 4 is installed.
Are the XML and the XSLT file well-formed?
 
M

Mark Constant

Martin Honnen said:
Mark said:
I have a select box in HTML that calls upon a Javascript file.
Whenever I call the Javascript file it says "Object Required" for an
error message.

Which browser gives that error message? Which line is given as causing
the error?

<select name="select1"
onchange='CallXML(this.form.select1, "PS2");'>

CallXML(this, "PS2");
should suffice.
function CallXML(dropdown, Hardware)
{
var myIndex = dropdown.selectedIndex;
var SelValue = dropdown.options[myIndex].value;
var xsltTree = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");

This can only work with IE on Windows if MSXML 4 is installed. No IE
version installs that, IE6 only installs MSXML 3.
xsltTree.async = false;
xsltTree.load("Entertainment.xslt");

var srcTree = new ActiveXObject("Msxml2.DOMDocument.4.0");
srcTree.async = false;
srcTree.load("Entertainment.xml");


var xsltThread = new ActiveXObject("Msxml2.XSLTemplate.4.0");
xsltThread.stylesheet = xsltTree;
var xsltProc = xsltThread.createProcessor();
xsltProc.input = srcTree;
xsltProc.addParameter("Genre", SelValue);
xsltProc.addParameter("Hardware", Hardware);

xsltProc.transform();
document.all.layer1.innerHTML = xsltProc.output;
}

Let us know the details, which browser you have tried with, which line
is causing the errror, whether MSXML 4 is installed.
Are the XML and the XSLT file well-formed?

The error is in IE6 with MSXML installed and the error is
Line: 79 (Which is the beginning of the select statement)
Char: 1
Error: Object required
Code:0

I know the XML and XSLT are well-formed because I can use an only page
I had made and it works fine. For some reason I can't find any
differences in syntax between my old page and my new one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top