Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

Suggested practice exercises CHAPTER 14 553


the Google API to create a coordinate object based on latitude and longitude, and it’s
assigned to the coords variable. The next statement creates an object with the map
settings and assigns it to the options variable. The Map method in the Google API is
called, which renders the map in the mapcanvas variable and returns a reference to the
map. Finally, the Google API is used to create a marker with the current location.


  1. In Solution Explorer, right-click the default.html file and choose Set As Start Page.

  2. Test your work by pressing F5 to run the website.
    You should see the default.html page as shown in Figure 14-3.


FIGURE 14-3 he Google map with the current locationT

Suggested practice exercises


The following additional exercises are designed to give you more opportunities to practice
what you’ve learned and to help you successfully master the lessons presented in this chapter.
■■Exercise 1 Learn more about positioning by creating an application that retrieves the
user’s current location to help find nearby locations such as gas stations or restaurants.
■■Exercise 2 Learn more about monitored positioning by writing an application that
monitors your position and displays a trail of your travels on a map.
Free download pdf