TAILIEUCHUNG - JavaScript Bible, Gold Edition part 109

JavaScript Bible, Gold Edition part 109. 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. | 928 Part IV JavaScript Core Language Reference string. Another benefit to this scheme becomes apparent when you try to include a quoted string inside a string. For example say that you re assembling a line of HTML code in a variable that you will eventually write to a new window completely controlled by JavaScript. The line of text that you want to assign to a variable is the following INPUT TYPE checkbox NAME candy Chocolate To assign this entire line of text to a variable you have to surround the line in quotes. But because quotes appear inside the string JavaScript or any language has problems deciphering where the string begins or ends. By carefully placing the other kind of quote pairs however you can make the assignment work. Here are two equally valid ways result INPUT TYPE checkbox NAME candy Chocolate result INPUT TYPE checkbox NAME candy Chocolate Notice that in both cases the same unique pair of quotes surrounds the entire string. Inside the string two quoted strings appear that are treated as such by JavaScript. I recommend that you settle on one form or the other and then use that form consistently throughout your scripts. Building long string variables The act of joining strings together concatenation enables you to assemble long strings out of several little pieces. This feature is very important for some of your scripting for example when you need to build an HTML page s specifications entirely within a variable before writing the page to another frame with one statement. One tactic that I use keeps the length of each statement in this building process short enough so that it s easily readable in your text editor. This method uses the add-by-value assignment operator that appends the right-hand side of the equation to the left-hand side. Here is a simple example which begins by initializing a variable as an empty string var newDocument newDocument HTML HEAD TITLE Life and Times TITLE HEAD newDocument BODY H1 My Life and Welcome to It

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.