CS 10051 Lecture Notes - Lecture 27: Local Variable, Html Attribute, For Loop
Document Summary
Via the tag name var elem = document. getelementbyid(some_id) Elements of the el var imgtags = el. getelelentsbytagname(img) Repeat the number of times, add an image tag. Most derived from the html attributes of the tag. Can change and add things on the page. Children fall under another thing on the tree. For (counter = 0; counter <4 ; counter ++){ alert (counter); } If the counter is zero an alert will pop up, then it will add 1 to its number. If its less than 5 it will alert the counter the number plus 1. Like adding something to the little hole in scratch. Can be called upon from an external file or somewhere else on the webpage. Can be defined in the head or the body. A web page is a file, read one line at a time. Put functions near the top - so it loads well. Parm- parameter - local variable passes through the document.