TAILIEUCHUNG - JavaScript Bible, Gold Edition part 17

JavaScript Bible, Gold Edition part 17. 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. | CD-90 Part II JavaScript Tutorial String Objects You have already used String objects many times in earlier lessons. A string is any text inside a quote pair. A quote pair consists of either double quotes or single quotes. This allows one string to nest inside another as often happens in event handlers. In the following example the alert method requires a quoted string as a parameter but the entire method call also must be inside quotes. onClick alert Hello all JavaScript imposes no practical limit on the number of characters that a string can hold. However most older browsers have a limit of 255 characters in length for a script statement. This limit is sometimes exceeded when a script includes a lengthy string that is to become scripted content in a page. You need to divide such lines into smaller chunks using techniques described in a moment. You have two ways to assign a string value to a variable. The simplest is a basic assignment statement var myString Howdy This works perfectly well except in some exceedingly rare instances. Beginning with Navigator 3 and Internet Explorer 4 you can also create a string object using the more formal syntax that involves the new keyword and a constructor function that is it constructs a new object var myString new String Howdy Whichever way you use to initialize a variable with a string the variable receiving the assignment can respond to all String object methods. Joining strings Bringing two strings together as a single string is called concatenating strings a term you learned in Chapter 6. String concatenation requires one of two JavaScript operators. Even in your first script in Chapter 3 you saw how the addition operator linked multiple strings together to produce the text dynamically written to the loading Web page of B B . As valuable as that operator is another operator can be even more scripter friendly. This operator is helpful when you are assembling large strings in a single .

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.