160 likes | 263 Views
More HTML Forms. Document Trees. <html> <h1>Form One</h1> <form name=“ firstForm "> Address<input type="text" name=" address " size="30"> <br>Should we keep it? <input type="checkbox" name=“ keeper ”> <br><input type="radio" name=“ size ”>Small <br><input type="radio" name=" size ">Medium
E N D
Document Trees <html> <h1>Form One</h1> <form name=“firstForm"> Address<input type="text" name="address" size="30"> <br>Should we keep it? <input type="checkbox" name=“keeper”> <br><input type="radio" name=“size”>Small <br><input type="radio" name="size">Medium <br><input type="radio" name="size">Large </form> <h1>Form Two</h1> <form name=“secondForm” <br><select name="topping"> <option>Pepperoni <option>Sausage <option>Pineapple <option>Limburger and Onion </select> <br><input type="button" name="myButton" value=“My Button"> </form> </html>
Document Trees document secondForm firstForm myButton topping address keeper size value value value checked [2] [0] [1] checked checked checked
Document Tree Path Names document.firstForm.address.value=“1075 North”; document.secondForm (is a form) document.secondForm.myButton (is a button) document.secondForm.myButton.value (is a string) if (document.firstForm.keeper.checked) {…} if (document.firstForm.size[2].checked) {…} document secondForm firstForm myButton topping address keeper size value value value checked [2] [0] [1] checked checked checked
More Form Widget Events • Button, Check Box, Radio Buttons • onclick • Text Box, Text Area • onchange, onblur, onfocus, onselect • Selection List • onchange, onclick, onblur, onfocus
Debugging • What is a bug? • In the old days computers would fail because bugs would die on the circuits and short them out • A bug is a problem in a program that you need to find
Build a fence • Listen for the howl
Build a fence • Listen for the howl
Build a fence • Listen for the howl
Build a fence • Listen for the howl
Debugging with a wolf fence • Make your program do something that will show where the problem is • alert(“any string you want”);
Debugging • Find a way to make your problem smaller • Make a copy and cut features out of the copy that don’t relate to your problem • Put in Wolf fences to help you narrow down the problem