12.07.2015 Views

Pro JavaScript for Web Apps pdf - EBook Free Download

Pro JavaScript for Web Apps pdf - EBook Free Download

Pro JavaScript for Web Apps pdf - EBook Free Download

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 6 STORING DATA IN THE BROWSERreturn Number(this.quantity()) + someOtherValue;Using Persistence in the Offline ApplicationNow that I have modified the view model, I can change the main document to improve the way that Ihandle the <strong>for</strong>m element when the browser is offline. Listing 6-11 shows the changes to the HTMLmarkup.Listing 6-11. Adding Buttons That Handle the Form When the Browser Is Offline... $()($)Total:$...I have added a Save <strong>for</strong> Later button to the document, which is visible when the browser is offline. Ihave also changed the submit button so that it is visible only when the browser is online. Listing 6-12shows the corresponding changes to the script element.Listing 6-12. Changes to the script Element to Support Offline Formsvar cheeseModel = {154www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!