JavaScript Bible 5th Edition 2004 phần 6 pps

175 181 0
JavaScript Bible 5th Edition 2004 phần 6 pps

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

846 Part III ✦ Document Objects Reference Table 26-3 (continued) Filter Name Description and Properties RandomBars() Bar style transition Properties: duration (floating-point number of seconds) orientation (horizontal or vertical) percent (0 to 100) status 0 (stopped), 1 (applied), 2 (playing) Methods: apply() (freezes current display) play() (plays the transition) stop() (stops transition mid-stream) Shadow() Render as silhouette Properties: color (color value) direction (0, 45, 90, 135, 180, 225, 270, 315) Stripes() Striped style transition Properties: duration (floating-point number of seconds) motion (in or out) percent (0 to 100) status 0 (stopped), 1 (applied), 2 (playing) Methods: apply() (freezes current display) play() (plays the transition) stop() (stops transition mid-stream) Wave() Add sine-wave distortion Properties: add (1 or 0) freq (integer number of waves) light (strength 0 to 100) phase (percentage offset 0 to 100) strength (intensity 0 to 255) xRay() Render edges only Properties: None For more details on deploying filters in IE for Windows, visit http://msdn.microsoft.com/ workshop/author/filter/filters.asp. Because most of the live examples require WinIE5.5+, be sure to use that version for the best experience at that page. ✦✦✦ elementRef.style.filterObject JavaScript Core Language Reference ✦✦✦✦ In This Part Chapter 27 The String Object Chapter 28 The Math, Number, and Boolean Objects Chapter 29 The Date Object Chapter 30 The Array Object Chapter 31 Control Structures and Exception Handling Chapter 32 JavaScript Operators Chapter 33 Functions and Custom Objects Chapter 34 Global Functions and Statements Chapter 35 Body Text Objects ✦✦✦✦ PART IV IV [...]... result result = = = = = = = = = 0 (index of 1st letter is zero) 1 1 (start from 2nd letter) 3 (start from 3rd letter) 5 (start from 5th letter) 2 4 6 -1 (no “z” in string) Related Items: string.lastIndexOf(), string.charAt(), string.substring() methods 859 860 Part IV ✦ JavaScript Core Language Reference stringObject.lastIndexOf() string.lastIndexOf(searchString[, startIndex]) Returns: Index value of... form.result.value = “”; form.count.value = “”; } } Continued 861 862 Part IV ✦ JavaScript Core Language Reference stringObject.match() Listing 27-3 (continued) String Match with Regular Expressions Enter a main string: Enter a regular expression... Moz1+, Safari1+ The string.slice() method resembles the method string.substring() in that both let you extract a portion of one string and create a new string as a result (without modifying the 865 866 Part IV ✦ JavaScript Core Language Reference stringObject.slice() original string) A helpful improvement in string.slice(), however, is that specifying an ending index value relative to the end of the main... string.substr(), string.substring() methods 867 868 Part IV ✦ JavaScript Core Language Reference stringObject.split() string.split(“delimiterCharacter” [, limitInteger]) Returns: Array of delimited items Compatibility: WinIE4+, MacIE4+, NN3+, Moz1+, Safari1+ The split() method is the functional opposite of the array.join() method (see Chapter 30) From the string object point of view, JavaScript splits a long string... introduction to data types and values in Chapter 6 s tutorial scratched the surface of JavaScript s numeric and Boolean powers In this chapter, you look more closely at JavaScript s way of working with numbers and Boolean data Math often frightens away budding programmers; but as you’ve seen so far in this book, you don’t really have to be a math genius to program in JavaScript The powers described in this... expressed as exponents: 1e6 // 1,000,000 (the “+” symbol is optional on positive exponents) 1e-4 // 0.0001 (plus some error further to the right of the decimal) -4e-3 // -0.004 879 880 Part IV ✦ JavaScript Core Language Reference For values between 1e-5 and 1e15, JavaScript renders numbers without exponents (although you can force a number to display in exponential notation in IE5.5+, NN6+, and W3C browsers)... defined by the JavaScript string object Listing 27-1 shows how to create and use such a prototype Listing 27-1: A String Object Prototype String Object Prototype function makeItHot() { return “” + this.toString() + “”; } String.prototype.hot = makeItHot; document.write(“This... letter toward the front) 1 (start from 3rd letter working toward front) 3 (start from 5th letter) 2 [except for -1 Nav 2.0 bug] 4 6 -1 (no “z” in string) Related Items: string.lastIndexOf(), string.charAt(), string.substring() methods string.localeCompare(string2) Returns: Integer Compatibility: WinIE5.5+, MacIE-, NN6+, Moz1+, Safari1+ The localeCompare() method lets a script compare the cumulative Unicode... it is not part of the ECMA standard as of Edition 3 of the language spec But because the method is so widely used, the standard does acknowledge it so that other scripting contexts can implement the method consistent with browser practice Example Listing 27 -6 lets you experiment with a variety of values to see how the string.substr() method works Listing 27 -6: Reading a Portion of a String ... string.substr() (  0 1 Continued 869 870 Part IV ✦ JavaScript Core Language Reference stringObject.substr() Listing 27 -6 (continued) 2 3 5 , . characters. In JavaScript, the character conversions are string methods. Acceptable values depend on the browser that you are using. NN4 works only with the 2 56 ISO-Latin-I values; IE4+, NN6+, and W3C. name=”entry1” size= 6 /><br /> Enter a value 0-255:<input type=”text” name=”entry2” size= 6 /><br /> Enter a value 0-255:<input type=”text” name=”entry3” size= 6 /><br. in which JavaScript enables scripters to manipulate strings. Much of the syntax that you see in this chapter is identical to that of the Java programming language. Because the scope of JavaScript activity

Ngày đăng: 12/08/2014, 19:21

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan