Definition and Usage..
The domain property returns the domain name of the server that loaded the current document.
Syntax: document.domain
CODING:The domain property returns the domain name of the server that loaded the current document.
Syntax: document.domain
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display the domain name of the server that loaded this document.</p>
<button onclick="myFunction()">Display domain name</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.domain;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
<html>
<body>
<p>Click the button to display the domain name of the server that loaded this document.</p>
<button onclick="myFunction()">Display domain name</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.domain;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
Comments
Post a Comment