JavaScript in 10 Simple Steps or Less 2007 phần 6

, truy cập tên của cửa sổ, thao tác văn bản trong thanh trạng thái, và kiểm tra trạng thái mở hoặc đóng cửa của cửa sổ. Các phương pháp cho phép người dùng hiển thị một loạt các hộp thoại, cũng như để mở cửa sổ và cửa sổ mới mở gần. | Part 6 Manipulating Cookies Task 146 Creating a Cookie in JavaScript Task 147 Accessing a Cookie in JavaScript Task 148 Displaying a Cookie Task 149 Controlling the Expiry of a Cookie Task 150 Using a Cookie to Track a User s Session Task 151 Using a Cookie to Count Page Access Task 152 Deleting a Cookie Task 153 Creating Multiple Cookies Task 154 Accessing Multiple Cookies Task 155 Using Cookies to Present a Different Home Page for New Visitors Task 156 Creating a Cookie Function Library Task 157 Allowing a Cookie to be Seen for all Pages in a Site 302 Part 6 Task Creating a Cookie in JavaScript notes Normally cookies are simple variables set by the server in the browser and returned to the server every time the browser accesses a page on the same server. They are typically used to carry persistent information from page to page through a user session or to remember data between user sessions. With JavaScript though you can create and read cookies in the client without resorting to any server-side programming. The escape function takes a string and escapes any characters that are not valid in a URL. Escaping involves replacing the character with a numeric code preceded by a percent sign. For instance spaces become 20 see Step 5 . JavaScript cookies are stored in the object and are created by assigning values to this object. When creating a cookie you typically specify a name value and expiration date and time for that cookie. The cookie will then be accessible in your scripts every time the user returns to your site until the cookie expires. These cookies will also be sent to your server every time the user requests a page from your site. The simplest way to create a cookie is to assign a string value to the object which looks like this name value expires date The name is a name you assign to the cookie so that you can refer to it later when you want to access it. The value is any text string that has been escaped as if it were going

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
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.