Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax ISBN: 978-0-471-77778-6
This is the forum to discuss the Wrox book Professional Ajax by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780471777786
Important: For the new 2nd edition of this book, please post here instead: [url="http://p2p.wrox.com/forum.asp?FORUM_ID=307"]http://p2p.wrox.com/forum.asp?FORUM_ID=307[/url]
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax ISBN: 978-0-471-77778-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2006, 03:46 PM
Registered User
Points: 31, Level: 1
Points: 31, Level: 1 Points: 31, Level: 1 Points: 31, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2006
Location: Kanata, Ontario, Canada.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cross browser compatibility

Hello:
I have been trying to figure out what is wrong with my code given below:

<html>
    <title> ESM Menu Display</title>


<head>
<script type = "text/javascript" src = "/zxml.src.js"> </script>

        <script type ="text/javascript">
            var req;


            function request()
            {
                req = new XMLHttpRequest();
                if (req)
                {
                    alert("object created!");
                }
                                req.onreadystatechange = testState;
                req.open("GET","/goform/asim_mainTWO", true);
                alert("nothing");


                req.send(null);


            }

            function testState()
            {


                    if(req.readyState==4)
                    {
                        changeText();
                    }

            }



            function changeText()
            {
                alert("changeText!");
                xmlDom = zXmlDom.createDocument();
                if (xmlDom)
                {alert("initiating XML DOM");}

                xslDom = zXmlDom.createDocument();
                if (xmlDom)
                {alert("initiating XML DOM");}

                xmlDom.async = false;
                xslDom.async = false;

                alert(req);


                xmlDom.loadXML(req.responseText);
                if (!xmlDom) {alert("no xml dom");}
                alert("loading XSL");
                xslDom.load("/menuDisplay.xsl");
                alert(xmlDom.xml);
                alert(xslDom.xml);


                if (xmlDom && xslDom)
                {
                          document.getElementById("div1").innerHTML = zXslt.transformToText(xmlDom, xslDom);
                }
            }

        </script>

    </head>
    <body onload = "request()">
        <div id = "div1"></div>
    </body>
</html>


-----------------------------------------------------------
The problem is that I am using goahead webserver and the sample files "menuDisplay.xsl", zxml.src.js and this HTML file are stored on this webserver's directory. The "goform" calls the "asim_mainTWO" function from where XML data (describing the menu) is written back. (this data is wellformed).
The code shown above executes fully in Internet Explorer and has a correct output. In firefox, it works prefectly untill it hits alert(xslDom.xml). where it just gives a blank alert. In the JAVASCRIPT CONSOLE it shows an error message saying that "this.documentElement" (points to a line in zxml.src.js) has no properties. Could you please explain why is that so and how should I get around it.

I have been working hard to fix this for about 3 days now but the code seems right. Moreover, please note that the code works fine across all browsers if the files (XML and XSL) are on my local directory.

Thanks,
I appreicate your patience in reading this long email.
Asim

 
Old August 8th, 2006, 04:42 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have u got the solution?.
I am also facing the same problem.
Have u get the solution plz forward to me.





 
Old November 8th, 2006, 04:30 PM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am also having the same problem and was hoping to find the answer here.



 
Old December 4th, 2006, 07:34 AM
Registered User
 
Join Date: Nov 2006
Location: Bangalore, Karnataka, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AbhijitSinha
Default

Hey Hussian,
With respect to ur code, there is a slight modification that u need to make in the function request.
I have made the change. This should work.

function request()
{
        try
    {
        //Code for Mozilla and other browsers
        if (window.XMLHttpRequest)
                {
                    req = new XMLHttpRequest();
                }
                // code for IE below ver.7
                else if (window.ActiveXObject)
                {
                    req = new ActiveXObject("Microsoft.XMLHTTP");
                }
         }
         catch(Ex)
     {
        req = null;//Else assign null to request
     }
                if (req)
                {
                    alert("object created!");
                }
                                req.onreadystatechange = testState;
                req.open("GET","/goform/asim_mainTWO", true);
                alert("nothing");

                req.send(null);
            }





Similar Threads
Thread Thread Starter Forum Replies Last Post
VBscript browser compatibility 1up HTML Code Clinic 1 December 12th, 2005 05:41 PM
Designing for cross browser site joefawcett CSS Cascading Style Sheets 3 June 22nd, 2005 08:09 AM
Browser compatibility chokk Beginning PHP 4 May 18th, 2005 01:51 AM
Cross Browser DHTMLMenu flash2004 Javascript 0 March 30th, 2005 02:30 AM
To check the browser compatibility lily611 ADO.NET 2 June 14th, 2004 07:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.