Could use a little help with this if you guys don't mind. This is just for testing purposes for a potential project. Trying to keep it simple at this point. I have an HTML file called projectform.html. Basic html input box with a button. I want to type a name into that box, click on the button and change the value of an XML file. projectform.html
<html><head> <title>Information Screen Form</title> <script src="jquery-1.9.1.min.js"></script> <script src="project.js"></script> <script>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","datatest.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML;</script> </head><body> <div id="main"> <input type="text" id="inputname"> <input type="button" onclick="savename()"; value="Submit"></div></body></html>
project.jsfunction savename()
{ xmlDoc=loadXMLDoc("datatest.xml"); x=xmlDoc.getElementsByTagName("fname")[0].childNodes[0]; x.nodeValue=document.getElementById("inputname");}
XML just has the tags at this point. <?xml version="1.0" encoding="UTF-8" ?> <nurse> <fname>Tonya</fname> </nurse>