SPATIALLY ENABLED WEB APPLICATIONS in Font

Draw Data Matrix ECC200 in Font SPATIALLY ENABLED WEB APPLICATIONS

CHAPTER 10 SPATIALLY ENABLED WEB APPLICATIONS
ECC200 Printer In None
Using Barcode generator for Font Control to generate, create ECC200 image in Font applications.
www.OnBarcode.com
Creating PDF-417 2d Barcode In None
Using Barcode printer for Font Control to generate, create PDF 417 image in Font applications.
www.OnBarcode.com
This included file (functions.js) is where all of your JavaScript-based Ajax functionality is located, as well as where the Google map code is contained. We will analyze this file in more detail next:
Encode UCC.EAN - 128 In None
Using Barcode maker for Font Control to generate, create USS-128 image in Font applications.
www.OnBarcode.com
Code 128A Generator In None
Using Barcode generator for Font Control to generate, create Code 128 image in Font applications.
www.OnBarcode.com
<script src="functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style.css" /> <title>Video Games Jones-ing Helper</title> </head>
Draw Barcode In None
Using Barcode encoder for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
Data Matrix Maker In None
Using Barcode creator for Font Control to generate, create Data Matrix 2d barcode image in Font applications.
www.OnBarcode.com
Using the onload event, you initialize your application. As you will see later when you look at functions.js, you pass the ID of the div that holds the Google map, and the ID of the div that holds your status message:
QR Code Encoder In None
Using Barcode generation for Font Control to generate, create QR-Code image in Font applications.
www.OnBarcode.com
USPS OneCode Solution Barcode Printer In None
Using Barcode printer for Font Control to generate, create 4-State Customer Barcode image in Font applications.
www.OnBarcode.com
<body onload="init('map', 'messages')"> <div id="main">
Data Matrix 2d Barcode Maker In None
Using Barcode creator for Online Control to generate, create ECC200 image in Online applications.
www.OnBarcode.com
Drawing Data Matrix In VS .NET
Using Barcode generation for VS .NET Control to generate, create Data Matrix image in Visual Studio .NET applications.
www.OnBarcode.com
Every application that uses Google Maps must have an HTML element (such as a div) in which the map can be loaded. You are free to style it however you want (Google maps will display based on the width and height attributes, which you specify in your style sheet), but this is the element the map will attempt to load into:
Encode Barcode In Visual Studio .NET
Using Barcode encoder for Reporting Service Control to generate, create Barcode image in Reporting Service applications.
www.OnBarcode.com
Printing UPC Code In Visual Basic .NET
Using Barcode maker for VS .NET Control to generate, create UPC Code image in Visual Studio .NET applications.
www.OnBarcode.com
<div id="map"></div>
Drawing Barcode In Java
Using Barcode maker for Android Control to generate, create Barcode image in Android applications.
www.OnBarcode.com
Creating UCC - 12 In None
Using Barcode printer for Excel Control to generate, create UCC - 12 image in Excel applications.
www.OnBarcode.com
Next, you have your div to hold application status messages. You first check whether a message has been set via URL, and display that. If it hasn t been set, you output an empty div, and then hide it via CSS. This will be used later by JavaScript, which will populate the div and then make it visible again:
PDF 417 Drawer In C#
Using Barcode creation for Visual Studio .NET Control to generate, create PDF-417 2d barcode image in VS .NET applications.
www.OnBarcode.com
Reading Barcode In None
Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
< php if (strlen($message) > 0) { > <div id="messages"> < php echo htmlentities($message) > </div> < php } else { > <div id="messages" style="display: none"></div> < php } >
Encoding Matrix In Visual Basic .NET
Using Barcode drawer for .NET framework Control to generate, create 2D Barcode image in VS .NET applications.
www.OnBarcode.com
Making GTIN - 12 In None
Using Barcode drawer for Word Control to generate, create UCC - 12 image in Office Word applications.
www.OnBarcode.com
Last, you display the form used to add new locations. You use the onsubmit event so that you can use Ajax to process the form, but also allow it to fall back to use the process_form.php script directly if JavaScript isn t enabled:
Linear Creation In .NET
Using Barcode maker for Visual Studio .NET Control to generate, create 1D image in VS .NET applications.
www.OnBarcode.com
Generating 1D In Visual C#.NET
Using Barcode generator for VS .NET Control to generate, create 1D Barcode image in .NET framework applications.
www.OnBarcode.com
CHAPTER 10 SPATIALLY ENABLED WEB APPLICATIONS
<h3>Add a New Location:</h3> <form method="post" action="process_form.php" onsubmit="submitForm(this); return false;"> <table> <tr> <td>Name:</td> <td><input type="text" name="locname" maxlength="150" /></td> </tr> <tr> <td>Address:</td> <td><input type="text" name="address" maxlength="150" /></td> </tr> <tr> <td>City:</td> <td><input type="text" name="city" maxlength="150" /></td> </tr> <tr> <td>Province:</td> <td><input type="text" name="province" maxlength="150" /></td> </tr> <tr> <td>Postal:</td> <td><input type="text" name="postal" maxlength="150" /></td> </tr> <tr> <td>Latitude:</td> <td><input type="text" name="latitude" maxlength="150" /></td> </tr> <tr> <td>Longitude:</td> <td><input type="text" name="longitude" maxlength="150" /></td> </tr> </table> <p> <input type="submit" value="Add Location" /> </p> </form> </div> </div> </body> </html>
CHAPTER 10 SPATIALLY ENABLED WEB APPLICATIONS
All right, so here is your functions.js file; this is where all of the Google Maps functionality and Ajax-based concepts are happening. Let s have a closer look. You first define mapContainer and msgContainer, which will hold the divs you created to hold your map and status message, respectively. You set these in the init() method. Next, you set the default values for your map: the default latitude and longitude and the zoom level. In this case, your map will automatically center on Calgary. Next, you set the URL from which you fetch the locations. Although this is a PHP file, it will return XML data, which you can then plot on your map. Finally, you have two small utility functions. The first is used to trim a value, which works the same as PHP s trim function (removing whitespace from the beginning and end of a string). You use this in your basic form validation. The second is used to write a message to your status message div.
//functions.js // div to hold the map var mapContainer = null; // div to hold messages var msgContainer = null; // coords for Calgary var mapLng = -114.06; var mapLat = 51.05; var mapZoom = 7; // locations xml file var locationsXml = 'locations.php'; function trim(str) { return str.replace(/^(\s+) (\S*)(\s+) $/, '$2'); } function showMessage(msg) { if (msg.length == 0) msgContainer.style.display = 'none'; else { msgContainer.innerHTML = msg; msgContainer.style.display = 'block'; } }
Copyright © OnBarcode.com . All rights reserved.