473,386 Members | 1,969 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,386 software developers and data experts.

Object Required

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;
}
Jul 20 '05 #1
2 2478


Mark Constant wrote:
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.
<option value="Fighting">Fighting</option>

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?
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Martin Honnen <ma*******@yahoo.de> wrote in message news:<40********@olaf.komtel.net>...
Mark Constant wrote:
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.
<option value="Fighting">Fighting</option>

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.
Jul 20 '05 #3

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

Similar topics

0
by: Ian Pilcher | last post by:
Howdy all! I'm working with XML schemas for the first time, so please be gentle! I am working on a graphics program (in Java if it matters), and I have decided to use XML files to store the...
0
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
6
by: Richard Steele | last post by:
I have a static object that gets referenced at application startup. This object stores a dataset and various strings to be used whenever required. This object may be called at anytime to provide...
9
by: Remulac | last post by:
Hello, I'm trying to get the value out of a dropdown list box and assign it to a variable. When I click on the list box, I invoke this line of code. I get the error, "Object reference not set...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
14
by: julie.siebel | last post by:
I've been wrestling with a really complex page. All the data is drawn down via SQL, the page is built via VBScript, and then controlled through javascript. It's a page for a travel company that...
1
by: Dave | last post by:
I have multiple forms that will create an object. Basically a energy efficiency measure object. The measure object will have a couple of required properties set but after that it can have 10-20...
4
by: ink | last post by:
Hi All I am relatively new to doing this and i think that i am making some king of school boy error. The error i am getting is on the following line of code. XmlSerializer xs = new...
14
by: chromis | last post by:
Hi, I've been trying to implement a more OOP oriented approach to dealing with user security on one of my websites, and I am trying to validate the user against an array of roles, however I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.