Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript issue

Status
Not open for further replies.

jcostanzo

Programmer
Nov 6, 2007
8
US
Ok I am having a problem and I cannot figure it out. In internet explorer the script works great. Firefox is being a pain.

Code:
<script type="text/javascript">
					var xmlDoc=null;
					if (window.ActiveXObject)
						{// code for IE
							xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
						}
					else if (document.implementation.createDocument)
						{// code for Mozilla, Firefox, Opera, etc.
							xmlDoc=document.implementation.createDocument("","",null);
						}
					else
						{
							alert('Your browser cannot handle this script');
						}
					if (xmlDoc!=null) 
						{
							xmlDoc.async=false;
							xmlDoc.load("xml/events.xml");
							var x=xmlDoc.getElementsByTagName("item");
					for (var i=0;i<x.length;i++)
						{ 
							document.write("<h4>");
							document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
							document.write("</h4>");
							document.write("<p>");
							document.write(x[i].getElementsByTagName("event")[0].childNodes[0].nodeValue);
							document.write("<br />");
							document.write("</p>");
						}
</script>

Any ideas?

My sites: amd
 
Code:
<script type="text/javascript">
                    var xmlDoc=null;
                    if (window.ActiveXObject)
                        {// code for IE
                            xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
                        }
                    else if (document.implementation.createDocument)
                        {// code for Mozilla, Firefox, Opera, etc.
                            xmlDoc=document.implementation.createDocument("","",null);
                        }
                    else
                        {
                            alert('Your browser cannot handle this script');
                        }
                    if (xmlDoc!=null)
                        {
                            xmlDoc.async=false;
                            xmlDoc.load("xml/events.xml");
                            var x=xmlDoc.getElementsByTagName("item");
                    for (var i=0;i<x.length;i++)
                        {
                            document.write("<h4>");
                            document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
                            document.write("</h4>");
                            document.write("<p>");
                            document.write(x[i].getElementsByTagName("event")[0].childNodes[0].nodeValue);
                            document.write("<br />");
                            document.write("</p>");
                        }
[COLOR=red]}[/color]
</script>
 
Very subtle reply. I have forgotten closing curly-barckets at least once in my career, and they can be murder to find.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top