getElementById delivDy var dates deliveryDay option var

Getelementbyid delivdy var dates deliveryday option

This preview shows page 50 - 53 out of 84 pages.

getElementById ( "delivDy" ); var dates = deliveryDay . getElementsByTagName ( "option" ); var deliveryMonth = document . getElementById ( "delivMo" ); var deliveryYear = document . getElementById ( "delivYr" ); var selectedMonth = deliveryMonth . options [ deliveryMonth . selectedIndex ]. value ; while ( dates [ 28 ]) { // remove child with index of 28 until this index is empty deliveryDay . removeChild ( dates [ 28 ]); } if ( deliveryYear . selectedIndex === - 1 ) { // if no year is selected, choose the default year so length of Feb can be determined deliveryYear . selectedIndex = 0 ; } if ( selectedMonth === "2" && deliveryYear . options [ deliveryYear . selectedIndex ]. value === "2018" ) { // if leap year, Feb has 29 days deliveryDay . appendChild ( twentyNine . cloneNode ( true )); } else if ( selectedMonth === "4" || selectedMonth === "6" || selectedMonth === "9" || selectedMonth === "11" ) { // these months have 30 days deliveryDay . appendChild ( thirty . cloneNode ( true )); } else if ( selectedMonth === "1" || selectedMonth === "3" || selectedMonth === "5" || selectedMonth === "7" || selectedMonth === "8" || selectedMonth === "10" || selectedMonth === "12" ) {
Image of page 50
S t u d e n t N u m b e r : 3 5 5 0 5 1 0 9 U n i q u e N u m b e r : 8 4 7 1 1 4 P a g e 51 | 84 // these months have 31 days deliveryDay . appendChild ( thirtyOne . cloneNode ( true )); } } /* remove default values and formatting from state and delivery date selection lists */ function removeSelectDefaults () { var emptyBoxes = document . getElementsByTagName ( "select" ); for ( var i = 0 ; i < emptyBoxes . length ; i ++) { emptyBoxes [ i ]. selectedIndex = - 1 ; } } /* remove fallback placeholder text */ function zeroPlaceholder () { var messageBox = document . getElementById ( "customText" ); messageBox . style . color = "black" ; if ( messageBox . value === messageBox . placeholder ) { messageBox . value = "" ; } } /* restore placeholder text if box contains no user entry */ function checkPlaceholder () { var messageBox = document . getElementById ( "customText" ); if ( messageBox . value === "" ) { messageBox . style . color = "rgb(178,184,183)" ; messageBox . value = messageBox . placeholder ; } } /* add placeholder text for browsers that don't support placeholder attribute */ function generatePlaceholder () { if (! Modernizr . input . placeholder ) { var messageBox = document . getElementById ( "customText" ); messageBox . value = messageBox . placeholder ; messageBox . style . color = "rgb(178,184,183)" ; if ( messageBox . addEventListener ) { messageBox . addEventListener ( "focus" , zeroPlaceholder , false ); messageBox . addEventListener ( "blur" , checkPlaceholder , false ); } else if ( messageBox . attachEvent ) { messageBox . attachEvent ( "onfocus" , zeroPlaceholder ); messageBox . attachEvent ( "onblur" , checkPlaceholder ); } } } /* copy values for Billing Address fields to Delivery Address fields */ function copyBillingAddress () { var billingInputElements = document . querySelectorAll ( "#billingAddress input" ); var deliveryInputElements = document . querySelectorAll ( "#deliveryAddress input" ); if ( document . getElementById ( "sameAddr" ). checked ) { for ( var i = 0 ; i < billingInputElements . length ; i ++) { deliveryInputElements [ i + 1 ]. value = billingInputElements [ i ]. value ; } document . querySelector ( "#deliveryAddress select" ). value = document . querySelector ( "#billingAddress select" ). value ; } else { for ( var i = 0 ; i < billingInputElements . length ; i ++) { deliveryInputElements [ i + 1 ]. value = "" ; }
Image of page 51
S t u d e n t N u m b e r : 3 5 5 0 5 1 0 9 U n i q u e N u m b e r : 8 4 7 1 1 4 P a g e 52 | 84 document . querySelector ( "#deliveryAddress select" ). selectedIndex = - 1 ; } } /* validate address fieldsets */ function validateAddress (
Image of page 52
Image of page 53

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture