Lab03 Guide
Lab03 Guide
Exercise 2: We can use javascript to create an element (html tag), add attributes,
and add it to the existing element.
For example, if we already have this structure:
<div id="data">
<p id="hello">Hello men</p>
</div>
Now we want to add a hyperlink into the <div> and below the <p> like this:
here is what we get (screenshot from Google Chrome and Inspect element):
3. Use this as parameter of event function to send data to the function. For
example:
function checkBoxChanged(box) {
if (box.checked) {
// checkbox is checked
}else {
Exercise 4: This exercise make an assumption that there are only 10 images.
Steps:
1. Use <select> tag with the property size = 10 to create a listbox.
2. Implement click event of <select>
3. To change the image, change src attribute of <img> tag:
image.setAttribute("src","abc.jpg")
4. To create a slideshow, use setInterval as demonstrated in video example.
5. To disable a button, set disabled = true for the disabled property.