Object Required

Discussion in 'Javascript' started by Mark Constant, Jan 28, 2004.

  1. 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;
    }
    Mark Constant, Jan 28, 2004
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Jan 28, 2004
    #2
    1. Advertising

  3. Martin Honnen <> wrote in message news:<4017a1c0$>...
    > 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.
    Mark Constant, Jan 28, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bucko
    Replies:
    1
    Views:
    328
    Alvin Bruney
    Oct 25, 2003
  2. rob

    Recordset - Object Required

    rob, Jun 7, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    2,240
    Trevor Benedict R
    Jun 15, 2004
  3. Just D.
    Replies:
    0
    Views:
    438
    Just D.
    Mar 10, 2006
  4. Carolyn Speakman
    Replies:
    1
    Views:
    1,039
    Keith M. Corbett
    Jul 30, 2004
  5. Eric
    Replies:
    0
    Views:
    593
Loading...

Share This Page