Question & Answer: The task is to write a JavaScript code that can build a dynamic webpage content. Please a…..

Assignmeht marRS Deadline: 15 August 2017 Question The task is to write a JavaSeript code that can build a dynamic webpage content. Please allow the user to: 1. Select any html element and place it in the webpage 2. Choose the attributes 3. Change the content of the element (depends on the element) 4. Choose the elements position. 5. Edit the element after being added to the page. 6. Build a form and with some elements 7. Add event listeners for any elements The JavaScript code then change the content of the webpage accordingly.8-

the due date is 14 -8-2017

The task is to write a JavaScript code that can build a dynamic webpage content. Please allow the user to: 1. Select any html element and place it in the webpage 2. Choose the attributes 3. Change the content of the element (depends on the element) 4. Choose the element’s position. 5. Edit the element after being added to the page. 6. Build a form and with some elements 7. Add event listeners for any elements The JavaScript code then change the content of the webpage accordingly.

Expert Answer

 

1. var x = document.getElementById(“id”);- This puts the element with id id in variable x. Now you can do any sort of JS code on it.

x.style.visiblity = “visible”; This shows an item which may have been hidden by you previous JS code.

2. var x = document.getElementById(“id”).getAttribute(“attribute”); This stores to x the attribute attribute of the element whose id is id.

3. This is not really a general question. This is a very specific question as to what do you want to change as you can change almost anything like color, text, image etc. So I will simply put a new text to an attribute.

document.getElementById(“id”).innerHTML = “Hello World”; This changes the text of element with id id to Hello World irrespective of what it was earlier.

4. document.getElementById(“id”).style.left = “300px”; This sets the left position of the element with id id. Instead of left you can also use right, top or bottom to position you element.

Still stressed from student homework?
Get quality assistance from academic writers!