
At first I looked through all the scripts from the fourth class and tried to meld them together in some weird hybrid (see previous post), but that didn't really work. After a long time, I looked through other people's blogs for some kind of help. Robin W.'s blog really helped me - she had code hints with comments that described each step of the script, so that I at least had some direction. Hopefully, moving forward, I will really be able to do this all on my own.
//get checkbox element using its id
//get billing elements using ids
//get shipping elements using ids
//if checkbox is checked, copy billing info to shipping
//if checkbox is unchecked, remove info from shipping
I didn't get around to:
//Validate Form
//code Submit button
A few things I struggled with:
- Remembering how/when to pass parameters into a function - I kept forgetting to put the checkbox id in the method copyOver() :
- <input type="checkbox" name="checkme" id="checkme" onclick="copyOver('checkme');" />
function copyOver(checkboxElId) {
//get checkbox element using its id
var checkboxEl = document.getElementById(checkboxElId);
later this would become checkboxEl.checked in the if statement
No comments:
Post a Comment