DOM:- (Document object model)
DOM:- (Document object model)
-document object model is representing all types of document process.
-document object model is used to document keyword.
-there are following implementation used in document object model
1)display title of the document:-
2)display URL of the document:-
3)display number of the link of the document:-
4)display number of the image of the document:-
1)display title of the document:-
-title print karana ho tb
<html>
<head>
<title> THIS IS MY FIRST APPLICATION </title>
<script language="JavaScript">
function display()
{
document.getElementById("P1").innerHTML=document.title;
}
</script>
</head>
<body>
<p id="P1"> </p>
<br>
<button onclick="display()"> SUBMIT </button>
</body>
</html>
2)display URL of the document:-
-link print karane ke liye use hota hai
<html>
<head>
<script language="JavaScript">
function display()
{
document.getElementById("p1").innerHTML=document.URL;
}
</script>
</head>
<body>
<p id="p1"> </p>
<br>
<button onclick="display()"> SUBMIT </button>
</body>
</html>
3)display number of the links of the document:-
- number of links show hojayega agr jitney bhi page hai utne link count karega.
- number of link ko findout karte hai.
<html>
<head>
<script language="JavaScript">
function display()
{
document.getElementById("p1").innerHTML=document.links.length;
}
</script>
</head>
<body>
<a href="a.html"> PAGE 1 </a>
<br>
<a href="b.html"> PAGE 2 </a>
<br>
<a href="c.html"> PAGE 3 </a>
<br>
<a href="d.html"> PAGE 4 </a>
<br>
<p id="p1"> </p>
<br>
<button onclick="display()"> SUBMIT </button>
</body>
</html>
4)display number of the image of the document:-
- imges number of images ko findout karte hai.
<html>
<head>
<script language="JavaScript">
function display()
{
document.getElementById("p1").innerHTML=document.images.length;
}
</script>
</head>
<body>
<img src="a.jpg">
<br>
<img src="b.jpg">
<br>
<img src="c.jpg">
<br>
<img src="d.jpg">
<br>
<p id="p1"> </p>
<br>
<button onclick="display()"> SUBMIT </button>
</body>
</html>
ASSIGMENT:-
combined all document implementation inside single program.
Comments
Post a Comment