Skip to content

HTML-DOM #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions JavaScript/Advance/DOM/4. HTML DOM/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DOM-Changing-HTML</title>
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="images/js-logo.png" type="image/x-icon">

</head>

<body>
<h1>DOM-Changing HTML</h1>
<h2>Example One</h2>
<p id="textOne">Hello There</p>
<button onclick="DisplayOne()">Click to change the above content</button><br><br>
<h2>Example Two</h2>
<img src="images/one.jpg" alt="" id="imgOne"><br>
<button onclick="DisplayTwo()">Click to change the above image</button>
<h2>Example Three</h2>
<p id="textTwo"></p>
<h2>Example Four</h2>
<p id="textThree"></p>
<script src="script.js"></script>
</body>

</html>
25 changes: 25 additions & 0 deletions JavaScript/Advance/DOM/4. HTML DOM/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//Example One
let textOne = document.getElementById('textOne');

function DisplayOne() {
textOne.innerHTML = "Hope you are Fine";
}
// Example Two
let imgOne = document.getElementById('imgOne');

function DisplayTwo() {
imgOne.src = "images/two.jpg"
}
// Example Three
let textTwo = document.getElementById('textTwo');

function DisplayThree() {
textTwo.innerHTML = "Date" + Date();
}
DisplayThree();

// Example Four

let textThree = document.getElementById('textThree');

textThree.innerHTML = document.write(Date())
8 changes: 8 additions & 0 deletions JavaScript/Advance/DOM/4. HTML DOM/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
h2 {
font-family: monospace;
}

img {
height: 300px;
width: 300px;
}