11HTML Forms: Interacting with the User

WHAT YOU WILL LEARN IN THIS CHAPTER:                

  • Scripting text, password, text area, and hidden form controls
  • Writing code for select, check box, and radio button form controls
  • Using JavaScript to interact with new HTML5 form controls

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

You can find the wrox.com code downloads for this chapter at http://www.wiley.com/go/BeginningJavaScript5E on the Download Code tab. You can also view all of the examples and related files at http://beginningjs.com.

Web pages would be very boring if you could not interact with or obtain information from the user, such as text, numbers, or dates. Luckily, with JavaScript this is possible. You can use this information within the web page, or you can post it to the web server where you can manipulate it and store it in a database if you wish. This chapter concentrates on using the information within the web browser, which is called client-side processing.

You’re quite accustomed to various user interface elements. For example, every operating system has a number of standard elements, such as buttons you can click; lists, drop-down list boxes, and radio buttons you can select from; and boxes you can check. These elements are the means by which you now interface with applications. The good news is that you can include many of these types of elements in your web page—and even better, it’s very easy to do so. When you have such an element—say, a button—inside your ...

Get Beginning JavaScript, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.