Download presentation
Presentation is loading. Please wait.
Published byAmy Moody Modified over 9 years ago
1
JavaScript onLoad getElement
2
onload
3
Using JavaScript to create content No user input Comes up when page LOADS [redo Koozebane; random picture]
4
Changes outside forms
5
Retrieving the value In JavaScript document.getElementById("name").value What does that mean? document: the web page getElementById: find this id on the page Returns an object Value: get the value of the object
6
Writing to the page Use an id on any element Replace the element using innerHTML Allows us to keep the correct semantics in HTML [Using innerHTML]
7
What to Write Generate HTML that you want. Concatenate literals and variables. Example: To build a paragraph using a variable called “content”. document.getElementById(“id”).innerHTML = ‘ ’+content+’ ’;
8
CHANGING HTML General structure: context.element.attribute Within form: formname.element.attribute form-name.input-id.value form-name.img-id.src Outside form: document.getElementById(“id-name”).attribute document.getElementById(“id”).innerHTML document.getElementById(“id”).className document.getElementById(“id”).src
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.