studentoftheliving Posted September 15, 2008 Share Posted September 15, 2008 I wrote a webpage using some techniques from the w3schools website. It was working fine on internet explorer but i downloaded firefox and it isn't working properly on there. Here is the webpage code: <html><head><script type="text/javascript" >function loadXMLDoc(dname) {try //Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); }catch(e) { try //Firefox, Mozilla, Opera, etc. { xmlDoc=document.implementation.createDocument("","",null); } catch(e) {alert(e.message)} }try { xmlDoc.async=false; xmlDoc.load(dname); return(xmlDoc); }catch(e) {alert(e.message)}return(null);}function loadXMLString(txt) {try //Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.loadXML(txt); return(xmlDoc); }catch(e) { try //Firefox, Mozilla, Opera, etc. { parser=new DOMParser(); xmlDoc=parser.parseFromString(txt,"text/xml"); return(xmlDoc); } catch(e) {alert(e.message)} }return(null);} </script></head><body><%dim checkname, checkpasscheckname = Request.Cookies("username")checkpass = Request.Cookies("password")Response.write("username is: " & checkname & " and password is: " & checkpass & "<br /><br /><br />")%><script type="text/javascript">jcheckname = "<%Response.write(checkname)%>";jcheckpass = "<%Response.write(checkpass)%>";dc=loadXMLDoc("people.xml");x=dc.getElementsByTagName("username");z=dc.getElementsByTagName("password");for (i=0;i<x.length;i++){if (x[i].childNodes[0].nodeValue== jcheckname) { if (z[i].childNodes[0].nodeValue == jcheckpass) { document.write("Hi, " + jcheckname + ". <a href=#>log out</a>"); } else { document.write("Hi, Stranger. <a href=#>log in</a>"); } }}</script></body></html> and here is the xml document that it links to: <?xml version="1.0" encoding="ISO-8859-1"?><userlist> <user> <username>sharecropper1</username> <password>share1</password> <email>student1</email> <firstname>louis</firstname> <lastname>the ghost</lastname> <addline1>555 arbitrary street</addline1> <addline2></addline2> <city>arbitrary</city> <state>mississippi</state> <zip5>35504</zip5> <zip4></zip4> <money>20.00</money> </user> <user> <username>sharecropper2</username> <password>share2</password> <email>student2</email> <firstname>louis</firstname> <lastname>the ghost</lastname> <addline1>555 arbitrary street</addline1> <addline2></addline2> <city>arbitrary</city> <state>mississippi</state> <zip5>35504</zip5> <zip4></zip4> <money>20.00</money> </user> <user> <username>sharecropper3</username> <password>share3</password> <email>student3</email> <firstname>louis</firstname> <lastname>the ghost</lastname> <addline1>555 arbitrary street</addline1> <addline2></addline2> <city>arbitrary</city> <state>iowa</state> <zip5>35504</zip5> <zip4></zip4> <money>20.00</money> </user> <user> <username>sharecropper4</username> <password>share4</password> <email>student4</email> <firstname>louis</firstname> <lastname>the ghost</lastname> <addline1>555 arbitrary street</addline1> <addline2></addline2> <city>arbitrary</city> <state>alabama</state> <zip5>35504</zip5> <zip4></zip4> <money>20.00</money> </user> <user> <username>sharecropper5</username> <password>share5</password> <email>student5</email> <firstname>louis</firstname> <lastname>the ghost</lastname> <addline1>555 arbitrary street</addline1> <addline2></addline2> <city>arbitrary</city> <state>alabama</state> <zip5>35504</zip5> <zip4></zip4> <money>20.00</money> </user> <user> <username>sharecropper6</username> <password>share6</password> <email>student6</email> <firstname>louis</firstname> <lastname>the ghost</lastname> <addline1>555 arbitrary street</addline1> <addline2></addline2> <city>arbitrary</city> <state>alabama</state> <zip5>35504</zip5> <zip4></zip4> <money>20.00</money> </user></userlist> in internet explorer .. everything works fine , but in firefox the cookie part displays, but the " Hi stranger, log in / Hi username, log out .. part does not display at all Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.