Email conversation
Sir,
I am trying to use your script to display content from
an XML file onto a browser. I am currently testing
this with 3 browsers, IE, Netscape and Firefox. While
i have been able to successfully display the xml
contents onto a html page, in the case of Netscape and
Firefox, the page doesn't seem to be loaded
completely. It displays the data correctly but it
seems like the page hangs or the loading icon
indicates that the page is still loading.
To explain in detail,i have an html file
readEmployees.html and a XML file that has some
content. I have your script in a separate file called
importxml.js. In the readEmployees.html, i have a
JavaScript function called printEmployees().
I am using this line in the body onload event for
readEmployees.html
<body
onload="javascript:void(importXML('employees.xml','printEmployees'));">
</body>
Could you please help me with the issue of the page
loading hanging up in case of Netscape and Firefox?
All my files are attached with this email.
I would really appreciate all your help and insight.
BTW, i am testing out your script to see if i can use
it to create a menu for an internal web site of a
State Agency that i work for.
Thanks and Best Regards,
Sunil Tuppale
From | Me |
To | Sunil Tuppale |
Subject | Re: Script Issues with Netscape and Firefox |
Date | 21 December 2005 21:33 |
Sunil,
> I am currently testing
> this with 3 browsers, IE, Netscape and Firefox.
Please note that I must ask you to test in Opera before I can help you with this issue.
http://www.opera.com/download/
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Sunil Tuppale |
To | Me |
Subject | Re: Script Issues with Netscape and Firefox |
Date | 21 December 2005 22:01 |
Mark,
Thanks for your prompt response. I just downloaded
opera and tested the page in Opera and it ran fine -
just as it did in IE
FYI.
Sincerely,
Sunil Tuppale
From | Me |
To | Sunil Tuppale |
Subject | Re: Script Issues with Netscape and Firefox |
Date | 22 December 2005 09:29 |
Attachments | Working script |
Sunil,
> Netscape and
> Firefox, the page doesn't seem to be loaded
> completely.
The gecko engine that both of these browsers use (since they are basically
the same browser) does not automatically use document.close() when you
finish writing a stream. To be honest, I do not see why you are using
document.write anyway. Once the page has loaded - which it has -
document.write changes behaviour. It does not add content to the page, it
replaces the page. This will happen in all browsers, just Gecko has an ugly
way of dealing with it.
You can use .innerHTML to do what you want. I have attached an updated
version that does what you want by using innerHTML. However, note that both
of these will not cope with characters like < > & or " inside
the XML values, since they will treat them as HTML markup characters. You
should use proper DOM methods if you need this to work, as I did in my
example on:
http://www.howtocreate.co.uk/tutorials/jsexamples/importingXML.html
Note, there is no need to use "javascript:" inside the onload event handler.
It is already running javascript. You also do not need to use void, since it
does not do anything with a return value. Those are only needed if you put
it in the href attribute of a link.
From | Sunil Tuppale |
To | Me |
Subject | Re: Script Issues with Netscape and Firefox |
Date | 22 December 2005 18:30 |
Mark,
I took your advice and tested the script on IE,
Netscape 7, Firefox and Opera and it works very well
in all the four.
Thanks a lot for all your time and help. If we decide
to use your
script to create our menu, you will be acknowledged by
me.
Best Regards,
Sunil
From | Sunil Tuppale |
To | Me |
Subject | Re: Script Issues with Netscape and Firefox |
Date | 3 January 2006 18:30 |
Attachments | Problematic script |
Mark,
Greetings and Best Wishes for a Happy New Year!
Over the holidays, i tried to extend the usage of your
script
to create a drop down menu that can be used across
browsers (IE, Netscape, Firefox and Opera mainly).
The items for the drop down menu are in the menus.xml
file. As per your recommendation, i have used
innerHtml. I am using styles to control the
appearance of the menus in IE as well as non IE
browsers. However, i find that the drop down menus
are rendered in IE and Opera, but in Netscape and
Firefox, i see only the main menu items. I wonder if
there is some problem applying styles in Netscape and
Firefox. Instead of creating the menus from XML, if i
hard code the html, i can view the menus in all the 4
browsers. It is only when i try to build the menu
from the XML that i am encountering problems with
Netscape and Firefox.
Could you please help me with this? I would be really
grateful to you. Attached are all the files i am
using.
BTW, i got the idea to use css for creating drop down
menus from the web site
[URL]
Once again thanks in advance for your time and help.
Regards,
Sunil
From | Me |
To | Sunil Tuppale |
Subject | Re: Script Issues with Netscape and Firefox |
Date | 3 January 2006 23:30 |
Sunil,
> However, i find that the drop down menus
> are rendered in IE and Opera, but in Netscape and
> Firefox, i see only the main menu items.
You will be happy to hear that this is a fairly simple problem. You are
using this CSS selector:
.holder:hover
You are also not using a doctype, so all browsers use quirks mode rendering.
In quirks mode, Gecko will only apply hover effects to links unless you
explicitly say what element to apply it to (this is to compensate for
authors who expect IE's :hover behaviour). Opera is a little more relaxed,
and will also apply it to classes as well.
If you use this CSS selector instead, it will work as you want:
div.holder:hover
From | Sunil Tuppale |
To | Me |
Subject | Re: Script Issues with Netscape and Firefox |
Date | 4 January 2006 16:39 |
Mark,
I am really happy that it was a simple fix. I really
appreciate and thank you for your help. I am just
getting into DHtml and all the front end stuff. I am
a sever side Java Developer working for [company].
You mention i wasn't using a doctype.
Could you please tell me if i should and if so, how i
could?
[snip.]
Once again Thanks a lot and Best Regards,
Sunil