Beginning Ajax with PHP ( PHP AND AJAX Tool Tips One of the more) - P.3

Tham khảo sách 'beginning ajax with php ( php and ajax tool tips one of the more) - ', 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 2 49 PM Page 44 44 CHAPTER 3 PHP AND AJAX Tool Tips One of the more common DHTML tricks you will see on the Internet is the tool tip. This is basically a little box filled with information that will appear above a properly placed cursor. While this is all fine and dandy the information contained within said box in non-Ajax enabled web sites is usually either hard-coded in or potentially loaded through some serverside trickery. What you will do in the next example is load the box dynamically using Ajax. As a useful addition to your calendar application it would be nice to dynamically display a box with all currently assigned tasks when a user hovers over a certain date. The PHP script would henceforth have to scour the database and return any instances of tasks associated with said day. Since I m not going to get into databases just yet I ll have you build the script to accommodate an array of tasks for now just to showcase the tool tip functionality. First off let s have a look at the file in order to view the changes to the calendar code Let s make an appropriate number of rows. for k 1 k numrows k tr php Use 7 columns for 7 days . for i 0 i 7 i startdate if startdate 0 startdate lastday If we have a blank day in the calendar. td style background FFFFFF nbsp td php else if startdate date j month date n year date Y td onclick createform event class calendartodayoff onmouseover calendartodayover checkfortasks php echo year . - . month . - . startdate event onmouseout calendartodayoff hidetask php echo date j td php else td onclick createform event class calendaroff onmouseover calendarover checkfortasks php echo year . - . month . - . startdate event onmouseout calendaroff hidetask php echo startdate td php tr php 9 27 06 2 49 PM Page 45 CHAPTER 3 PHP AND AJAX 45 The major change made here is calling a checkfortasks function that is fired by the onmouseover .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.