I am developing a simple log file using the XML file
values I have XML There is a value with last name
and first name
. I am accessing the file to validate logins and checking values against prices. It works fine in Chrome, IE and Safari. However, this is not being forwarded to the next page in Mozilla. The page remains in only one page and shows a loading url icon for an indefinite amount of time.
Here is my code:
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Script src = "https://code.jquery.com/jquery-1.10.2.js" & gt; & Lt; / Script & gt; & Lt; Link href = "css / stylemp3.css" rel = "stylesheet" type = "text / css" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form onsubmit = "myfunction return ()" action = "action.html" & gt; First name: & lt; Br / & gt; & Lt; Input type = "text" required = "required" name = "first name" id = "first name" /> & Lt; Br> Last name: & lt; Br> & Lt; Input type = "password" required = "required" name = "last name" id = "lastname" /> & Lt; Br / & gt; & Lt; Select class = "dropdown" id = "ddl" & gt; & Lt; Option value = "haha" selected = "selected" & gt; Show & lt; / Options & gt; & Lt; Option value = "hash" & gt; Hide & lt; / Options & gt; & Lt; / Select & gt; & Lt; Br / & gt; & Lt; Input type = "text" name = "hide" id = "hidee" class = "hide" /> & Lt; Br / & gt; & Lt; Input button type = "submit" value = "submit" /> & Lt; / Form & gt; & Lt; Div & gt; & Lt; / Div & gt; & Lt; Script & gt; Window.onload = function () {document.getElementById ("firstname"). Focus (); }; $ ("#ddl") .change (function () {if ($ ("select option: selected") .text () == "hide") {$ ("# hidee"). Hide ();} else {$ ("#wrap"). Show ();}}) .change (); & Lt; / Script & gt; & Lt; Script & gt; Function myFunction () {var lastname = document.getElementsByName ('lastname') [0] .value; Var firstname = document.getElementsByName ('firstname') [0]. value; If (window.XMLHttpRequest) {// code for IE7 +, Firefox, Chrome, Opera, Safari xmlhttp = New XMLHttpRequest (); } Else {// code for IE6, IE5 xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); } XMLhttp.open ("GET", "login.xml", Incorrect); Xmlhttp.send (); XmlDoc = xmlhttp.responseXML; Var x = xmlDoc.getElementsByTagName ("Login"); (I = 0; i & lt; x.length; i ++) {Warning (x [i] .getElementsByTagName ("first name") [0]. ChildNode [0] .nodeValue); If ((x [i] .getElementsByTagName ("firstname") [0] .childNodes [0] .nodeValue) == First name {alert ("Smileeee ..... :-))"); If ((x [i] .getElementsByTagName ("lastname") [0] .childNodes [0] .nodeValue) == Last Name) {Warning ("Login Successful !!!!!"); Back true; break; } } } return false; } & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;
No comments:
Post a Comment