TAILIEUCHUNG - JavaScript Bible, Gold Edition part 149

JavaScript Bible, Gold Edition part 149. 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. | 1328 Part V Putting JavaScript to Work while i cLen var j i labelLen if i j label var cEnd j if cEnd -1 cEnd return unescape j cEnd i return A global variable is used to act as a speedy intermediary between the actual browser cookie and the functions here that need to access cookie data. The setCurrState function contains a construction that you don t see much in this book but is quite valid. Notice the three-piece assignment statement. Evaluation of this statement works from right to left. The rightmost expression concatenates a cookie label and the value passed in as a parameter to the function. Note too that the value is passed through the escape function to properly URL-encode the data for the sake of data integrity so that spaces and odd punctuation don t mess up the mechanism . The concatenated value is assigned to the property. With the value safely dropped into the cookie it may be just one of several name value pairs for this domain the value of the property which includes all name value pairs for the domain is assigned to the mycookie global variable. Retrieving information from the cookie still requires a bit of parsing to be on the safe side. If other cookie writing were to come from the current server path more than one cookie would be available to the current document. Parsing the entire cookie for just the portion that corresponds to the currState labeled cookie ensures that the script gets only the data previously saved to that label. In an earlier version of this code the frequent access to the property inside the while loop of getCurrState wasn t a problem until the sluggish cookie reading performance of NN4 got in the way. Adapting the code to use the global variable for the repetitive parsing of the cookie value rescued the day. The focal point The toggle function which is pivotal in this outline scheme receives as a parameter .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.