tailieunhanh - Beginning Ajax with PHP ( SPATIALLY ENABLED WEB) - P.7

Tham khảo sách 'beginning ajax with php ( spatially enabled web) - ', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 9 27 06 11 59 AM Page 164 164 CHAPTER 10 SPATIALLY ENABLED WEB APPLICATIONS This included file 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 script src type text javascript script link rel stylesheet type text css href title Video Games Jones-ing Helper title head Using the onload event you initialize your application. As you will see later when you look at you pass the ID of the div that holds the Google map and the ID of the div that holds your status message body onload init map messages div id main 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 div id map div 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 php if strlen message 0 div id messages php echo htmlentities message div php else div id messages style display none div php 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 script directly if JavaScript isn t enabled 9 27 06 11 59 AM Page 165 CHAPTER 10 SPATIALLY ENABLED WEB APPLICATIONS 165 h3 Add a New Location h3 form method post action 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

TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.