TAILIEUCHUNG - JavaScript Bible, Gold Edition part 153

JavaScript Bible, Gold Edition part 153. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | 1368 Part V Putting JavaScript to Work The sample page described in this chapter and on the CD-ROM is pretty boring to look at because the power all lies in the scripting that users don t see see Figure 54-1 . Though this figure may be the most uninspired graphic presentation of the book the functionality may be the most valuable addition that you make to your Web site. Figure 54-1 An item flagged as being new since my last visit to the page When you first open the document do so from a copy on your hard disk so that you can modify the author time stamp in a moment all you see are the two items on the page without any flags. Although both entries have author time stamps that pre-date the time you re viewing the page a soft cookie does not yet exist against which to compare those times. But the act of making the first visit to the page has created a hard cookie of the date and time that you first opened the page. Quit the browser to get that hard cookie officially written to the cookie file. Then open the file in your script editor. Scroll to the bottom of the document where you see the BODY tag and the interlaced scripts that time stamp anything that you want on the page. This application is designed to display a special .gif image that says NEW 4U whenever an item has been updated since your last visit. Each interlaced script looks like this SCRIPT LANGUAGE newAsOf 12 Oct 2001 13 36 00 PDT SCRIPT By virtue of all scripts in this page being at the JavaScript level only those browsers so equipped will bother with the scripting which also means that others lose out on this great visitor service . The method writes to the page whatever HTML comes back from the newAsOf function. The parameter to the newAsOf function is what holds the author time stamp and zone offset information. The time stamp value must be in the string format as shown in the Chapter 54 Application Intelligent Updated Flags .

TỪ KHÓA LIÊN QUAN
Đã 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.