File tree Expand file tree Collapse file tree 6 files changed +62
-0
lines changed
JavaScript/Advance/DOM/4. HTML DOM Expand file tree Collapse file tree 6 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+
4+ < head >
5+ < meta charset ="UTF-8 ">
6+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
7+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
8+ < title > DOM-Changing-HTML</ title >
9+ < link rel ="stylesheet " href ="style.css ">
10+ < link rel ="shortcut icon " href ="images/js-logo.png " type ="image/x-icon ">
11+
12+ </ head >
13+
14+ < body >
15+ < h1 > DOM-Changing HTML</ h1 >
16+ < h2 > Example One</ h2 >
17+ < p id ="textOne "> Hello There</ p >
18+ < button onclick ="DisplayOne() "> Click to change the above content</ button > < br > < br >
19+ < h2 > Example Two</ h2 >
20+ < img src ="images/one.jpg " alt ="" id ="imgOne "> < br >
21+ < button onclick ="DisplayTwo() "> Click to change the above image</ button >
22+ < h2 > Example Three</ h2 >
23+ < p id ="textTwo "> </ p >
24+ < h2 > Example Four</ h2 >
25+ < p id ="textThree "> </ p >
26+ < script src ="script.js "> </ script >
27+ </ body >
28+
29+ </ html >
Original file line number Diff line number Diff line change 1+ //Example One
2+ let textOne = document . getElementById ( 'textOne' ) ;
3+
4+ function DisplayOne ( ) {
5+ textOne . innerHTML = "Hope you are Fine" ;
6+ }
7+ // Example Two
8+ let imgOne = document . getElementById ( 'imgOne' ) ;
9+
10+ function DisplayTwo ( ) {
11+ imgOne . src = "images/two.jpg"
12+ }
13+ // Example Three
14+ let textTwo = document . getElementById ( 'textTwo' ) ;
15+
16+ function DisplayThree ( ) {
17+ textTwo . innerHTML = "Date" + Date ( ) ;
18+ }
19+ DisplayThree ( ) ;
20+
21+ // Example Four
22+
23+ let textThree = document . getElementById ( 'textThree' ) ;
24+
25+ textThree . innerHTML = document . write ( Date ( ) )
Original file line number Diff line number Diff line change 1+ h2 {
2+ font-family : monospace;
3+ }
4+
5+ img {
6+ height : 300px ;
7+ width : 300px ;
8+ }
You can’t perform that action at this time.
0 commit comments