How to use DOM Node LookupNameSpaceUrl in JavaScript

In this article I am going to explain about DOM Node lookupNameSpaceUrl() Method in JavaScript.
  • 1139

JavaScript DOM Node lookUpNameSpaceUrl() Method

JavaScript lookupNameSpaceUrl() method use for find the Url of specified prefix for specified defined node.

Syntax

node.lookupNameSpaceUrl(preefix)

Example

<html>

<head>

    <script type="text/javascript">

        function myfun() {

            var http;

            if (window.XMLHttpRequest) { hh = new XMLHttpRequest(); }

            else { hh = new ActiveXObject("Microsoft.XMLHTTP"); }

 

            hh.open("GET", "myfile.xml", false);

            hh.send();

            var xmlDoc = hh.responseXML;

            var x = document.getElementById("tst");

            x.innerHTML = xmlDoc.documentElement.lookupNamespaceURI("c");

        };

    </script>

</head>

<body>

    <p id="tst">

        click button to check name space url in documenet file</p>

    <button onclick="myfun()">

        click me</button>

</body>

</html>

 

Output

 

 lookup.jpg

 

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.