0

I have a code which I have written in Javascript and HTML and its working perfectly fine how I want it to be, but the requirement is that the code should be in XML format. I don't know any XML so please help converting it.

Thank you.

Here is my code,

<html>
    <head>
        <title>dropdown</title>
        <script type="text/javascript">
            function myfun(){
            var a = document.getElementById("host").value
            localStorage.setItem('a',a);
            var b = localStorage.getItem('a')
            console.log("stored :" + a);
            console.log("retrived :" + b);
            return b;
            }
        </script>
    </head>

    <body onload="myfun()">
        <h1 align="center">Example</h1>
        <hr />

        <a href="first.html" target="_top">Home</a>
        <a href="authentication.html" target="_top">Authentication</a>
        <a href="help.html" target="_top">Help Desk</a>
        <a href="fabric.html" target="_top">Fabric</a> <br> <br>

        <select id="host" name="Host" onchange="myfun()">   
            <option value="10.11.0.34">10.11.0.34</option>
            <option value="10.11.0.35">10.11.0.35</option>
            <option value="10.11.0.36">10.11.0.36</option>
        </select>
        <p>this is home page</p>
    </body>
</html>
Al Foиce ѫ
  • 4,195
  • 12
  • 39
  • 49
user2675459
  • 33
  • 1
  • 5
  • Possible duplicate of [Converting HTML to XML](http://stackoverflow.com/questions/10473875/converting-html-to-xml) – DanMan Oct 03 '16 at 08:00
  • HTML is _almost_ a superset of XML (XHTML is really XML). Complying with what's considered valid XML shouldn't be that hard. Try any XML validator and see what the errors are. I can tell you you'll need to use CDATA for the JS code and will need to properly close those `
    ` tags. Other than that you're missing an XML header that specifies a correct encoding.
    – Sergiu Paraschiv Oct 03 '16 at 08:00
  • @DanMan, will look into that. thank you. – user2675459 Oct 03 '16 at 09:21
  • @Sergiu Paraschiv, thank you for the information. i will try to use the code been mentioned. – user2675459 Oct 03 '16 at 09:25

0 Answers0