Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Linkedin ome Tools css-hw1-2.pdt s-hw1.pd js-hw2.pdfx Problem 2 (10 points): Cre

ID: 3920008 • Letter: L

Question

Linkedin ome Tools css-hw1-2.pdt s-hw1.pd js-hw2.pdfx Problem 2 (10 points): Creating, replacing, and removing elements from a DOM tree. 1. Review createflement, appendChild, create TextNode, hidden global attribute of HTML elements, removeAttribute, createAttribute, setAttributeNode, replaceChild 2. Open your js-hw2 project if it has been closed 3. Right click on the js-hw2 folder and add an HTML file named crud.html (CRUD stands for create, read, update, and delete). Define four buttons with the captions Remove, Next, Previous, and Replace, respectively, as in cinput type-"button "...> in a element. You will use these buttons to invoke JS functions, for example, . See the simple example below: a. MacBook Air F3 FS F7 8

Explanation / Answer

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<a id="myFunction">A Link: create</a>
<TITLE> Dom Tree Operations </TITLE>
<style>
#myDIV {
    border: 1px solid black;
    margin-bottom: 10px;
}
</style>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script>
function myFunction() {
   var anchor = document.getElementById("myAnchor");
    var att = document.createAttribute("href");
   att.value = "create";
   anchor.setAttributeNode(att);
    var att = document.createTextNode("Hi, Welcome to JavaScript Word.");
    create.appendChild(att);
    document.getElementById("myDIV").appendChild(att);
}
(
function(){
'use scrict'
var newElement = document.cereateElement('li');
newElement.textContent = 'Hi!, Friens Welcome to JS Word!!!';

var list = document.getElementById('my-list');

list.insertBefore(newElement,list.firstElementChild);


var replaceElement = document.cereateElement('li');
replaceElement.textContent = 'I am replacing You!!';
list.replaceChild(newElement);

console.log(newElement);

}
());
</script>
<BODY>
<form action="">
<table BORDER="1">
<tr>
    <td><th>Firstname: <input type="text" name="firstname"></th></td> </tr><br/>
    <tr><td><th>Lastname: <input type="text" name="lastname"></th></td> </tr><br/>
    <tr><td><th>Age: <input type="text" name="age"></th></td> </tr>
</tr>
<tr><td><th><input id="Create" type="button" value="create"></th></td>
<td><th><input id="Replace" type="button" value="submit"></th></td>
<td><th><input id="Remove" type="button" value="submit"></th></td></tr>

<tr><td><th><input id="Submit" type="button" value="submit"></th></td></tr>
</table>
</form>
</BODY>
</HTML>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote