1. Trang chủ
  2. » Công Nghệ Thông Tin

javascript programmer''''s reference phần 5 pdf

262 610 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 262
Dung lượng 1,69 MB

Nội dung

H – HTML Character entity (Definition) 1045 Numeric Named Description Netscape MSIE &#169; &copy; Copyright Yes Yes &#170; &ordf; Feminine ordinal Yes Yes &#171; &laquo; Left angle quote Yes Yes &#172; &not; Not sign Yes Yes &#173; &shy; Soft hyphen Displays ? Yes &#174; &reg; Registered trademark Yes Yes &#175; &macr; Macron accent Yes Yes &#176; &deg; Degree sign Yes Yes &#177; &plusmn; Plus or minus Yes Yes &#178; &sup2; Superscripted 2 Displays ? Yes &#179; &sup3; Superscripted 3 Displays ? Yes &#180; &acute; Acute accent Yes Yes &#181; &micro; Micro sign Yes Yes &#182; &para; Paragraph Yes Yes &#183; &middot; Middle dot Yes Yes &#184; &cedil; Cedilla Yes Yes &#185; &sup1; Superscripted 1 Displays ? Yes &#186; &ordm; Masculine ordinal Yes Yes &#187; &raquo; Right angle quote Yes Yes &#188; &frac14; One quarter Displays ? Yes &#189; &frac12; One half Displays ? Yes &#190; &frac34; Three quarters Displays ? Yes &#191; &iquest; Inverted question mark Yes Yes &#192; &Agrave; Capital A grave Yes Yes &#193; &Aacute; Capital A acute Yes Yes &#194; &Acirc; Capital A circumflex Yes Yes &#195; &Atilde; Capital A tilde Yes Yes &#196; &Auml; Capital A umlaut Yes Yes &#197; &Aring; Capital A ring Yes Yes &#198; &AElig; Capital AE ligature Yes Yes &#199; &Ccedil; Capital C cedilla Yes Yes &#200; &Egrave; Capital E grave Yes Yes &#201; &Eacute; Capital E acute Yes Yes &#202; &Ecirc; Capital E circumflex Yes Yes Table continued on following page JavaScript Programmer's Reference 1046 Numeric Named Description Netscape MSIE &#203; &Euml; Capital E umlaut Yes Yes &#204; &Igrave; Capital I grave Yes Yes &#205; &Iacute; Capital I acute Yes Yes &#206; &Icirc; Capital I circumflex Yes Yes &#207; &Iuml; Capital I umlaut Yes Yes &#208; &ETH; Capital eth Displays ? Bugged &#209; &Ntilde; Capital N tilde Yes Yes &#210; &Ograve; Capital O grave Yes Yes &#211; &Oacute; Capital O acute Yes Yes &#212; &Ocirc; Capital O circumflex Yes Yes &#213; &Otilde; Capital O tilde Yes Yes &#214; &Ouml; Capital O umlaut Yes Yes &#215; &times; Multiply Displays ? Yes &#216; &Oslash; Capital O slash Yes Yes &#217; &Ugrave; Capital U grave Yes Yes &#218; &Uacute; Capital U acute Yes Yes &#219; &Ucirc; Capital U circumflex Yes Yes &#220; &Uuml; Capital U umlaut Yes Yes &#221; &Yacute; Capital Y acute Displays ? Yes &#222; &THORN; Capital thorn Displays ? Bugged &#223; &szlig; Small sz ligature Yes Yes &#224; &agrave; Small a grave Yes Yes &#225; &aacute; Small a acute Yes Yes &#226; &acirc; Small a circumflex Yes Yes &#227; &atilde; Small a tilde Yes Yes &#228; &auml; Small a umlaut Yes Yes &#229; &aring; Small a ring Yes Yes &#230; &aelig; Small ae ligature Yes Yes &#231; &ccedil; Small c cedilla Yes Yes &#232; &egrave; Small e grave Yes Yes &#233; &eacute; Small e acute Yes Yes &#234; &ecirc; Small e circumflex Yes Yes &#235; &euml; Small e umlaut Yes Yes &#236; &igrave; Small i grave Yes Yes &#237; &iacute; Small i acute Yes Yes &#238; &icirc; Small i circumflex Yes Yes Table continued on following page H – HTML Character entity (Definition) 1047 Numeric Named Description Netscape MSIE &#239; &iuml; Small i umlaut Yes Yes &#240; &eth; Small eth Displays ? Bugged &#241; &ntilde; Small n tilde Yes Yes &#242; &ograve; Small o grave Yes Yes &#243; &oacute; Small o acute Yes Yes &#244; &ocirc; Small o circumflex Yes Yes &#245; &otilde; Small o tilde Yes Yes &#246; &ouml; Small o umlaut Yes Yes &#247; &divide; Divide Yes Yes &#248; &oslash; Small o slash Yes Yes &#249; &ugrave; Small u grave Yes Yes &#250; &uacute; Small u acute Yes Yes &#251; &ucirc; Small u circumflex Yes Yes &#252; &uuml; Small u umlaut Yes Yes &#253; &yacute; Small y acute Displays ? Yes &#254; &thorn; Small thorn Displays ? Bugged &#255; &yuml; Small y umlaut Yes Yes Warnings: ❑ Inside <SCRIPT> tags, you are inside the JavaScript source domain and you use a different set of escape mechanisms. If you use the HTML escape mechanisms inside JavaScript source, your script is likely to break unless you are intentionally outputting them to the HTML source space via a document.write() method. ❑ The character set you are using inside the <SCRIPT> tags is completely different to that used in HTML. The script source is written using Unicode characters (ISO 10646). If you are generating HTML, a great manyof the character codes are mapped differently. This is because the HTML character entities are defined according to an ISO standard (ISO 8859). Even then, national language variants of the browser should map the character entity values to the correct character glyph which should ensure that what the designer intended is what you actually see, regardless of the actual character code transformations that take place. ❑ Most of the character entities are supported by both MSIE and Netscape. A few characters are supported inconsistently. All of the character entities with values less than 32 are control codes anyway, so although the browsers treat them differently, it shouldn't prove to be significant. Those character entities that are undefined in the HTML specification aren't supported in the same way either, and should probably be avoided. Recent updates to the HTML standard allow for Unicode character values to be used above character entity 255, and some of these have symbolic names defined. Refer tothe HTML specification available from the W3C at http://www.w3.org/TR/html4/ for further details. ❑ Of the rest: ❑ The general currency symbol (¤) is unsupported. JavaScript Programmer's Reference 1048 ❑ There is currently no Euro symbol implemented although its character entity • and Unicode value 20AC are defined but not in the version of the Unicode standard that is currently mandated (version 2.0). Unicode is about to undergo a revision and at that time, browser manufacturers will then need to accommodate the changes to remain compliant. ❑ The broken vertical bar (¦) does not work on Netscape, nor does the soft hyphen (), and neither do the superscripted numbers and fractional values. ❑ ETH and THORN are broken in both browsers in both upper and lower case variants. ❑ Netscape also lacks support for Y acute in both upper and lower case. ❑ Most of these are fairly obscure and not likely to cause much difficulty aside from some very specialized national language support. TheEuro character, however, is likely to become more important whether the currency thrives or not. See also: Escaped JavaScript quotes in HTML,Portability Web-references: http://www.w3.org/TR/html4/ HTML Comment tag (<! >) (HTML Tag) HTML comments can be used to hide scripts. See also: COMMENT object, Hiding scripts from old browsers HTML Component (Definition) An HTML Component is a small modular fragment of script contained in an .htc file and can be shared across several pages. These used to be called scriptlets but have evolved into HTML Components. Do not confuse them with Windows Script Host scriptlets: these are something different altogether. See also: Scriptlet Web-references: http://msdn.microsoft.com/workshop H – HTML entity escape (Pitfall) 1049 HTML entity escape (Pitfall) It looks like HTML but it isn't intended to be. You can sometimes innocently include some text into your script that when presented with adocument.write(), gets completely misunderstood by the HTML parser. This will almost certainly be due to the presence of "<" and">" characters in the output. It is likely that the browser will see what it thinks is a tag, but then ignore it according to the "I don't know what it is - so I won't display it" rule, as it won't be a recognized tag. Use HTML escapes to output the character as intended. This is important for the following characters if not for others: < becomes &lt; > becomes &gt; & becomes &amp; See also: Pitfalls Cross-references: Wrox Instant JavaScript - page 46 HTML file (Definition) HTML web page file. JavaScript is contained in HTML files with the <SCRIPT> tag. This is called client side JavaScript. See also: <SCRIPT>, File extensions, Web browser Cross-references: Wrox Instant JavaScript – page 3 HTML object (Object/HTML) An object in MSIE that represents an <HTML> tag. Availability: DOM level - 1 JavaScript - 1.5 JScript - 3.0 Internet Explorer - 4.0 Netscape - 6.0 JavaScript Programmer's Reference 1050 Inherits from: Element object IE myHTML = myDocument.all.anElementID IE myHTML = myDocument.all.tags("HTML")[0] IE myHTML = myDocument.all.tags("HTML")[anIndex] IE myHTML = myDocument.all[aName] IE myHTML = myDocument.all[anIndex] - myHTML = myDocument.documentElement - myHTML =myDocument.getElementById(anElementID) - myHTML =myDocument.getElementsByName(aName)[anIndex] JavaScript syntax: - myHTML =myDocument.getElementsByTagName ("HTML")[anIndex] HTML syntax: <HTML> </HTML> anIndex A selector for one particular HTML element aName An associative array reference Argument list: anElementID The ID value of an Element object Object properties: title,version Event handlers: onClick, onDblClick, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp This object is otherwise known as the HTML object. The <HTML> tag is a block-level tag, although it cannot be placed inside any other tag. Like the body tag, it is considered to be a block-level tag on grounds of its behavior in a framed context. Warnings: ❑ Be careful how you operate on this object. Traversing its properties in a for( in ) loop can recursively lock up your browser. ❑ The index value that points at this object in the all[] array for the document will be 0 if there is no DTD statement and 1 if there is. A correctly formed document should have a DTD statement. Use a dynamic mechanism for locating the object of type HTML instead of hardwiring the index value. See also: Attributes object, BODY.aLink, BODY.background, BODY.bgColor, BODY.link, BODY.text,BODY.vLink, Document object, Document.documentElement, Document.title, Element object Property JavaScript JScript N IE Opera DOM HTML Notes title - 3.0 + - 4.0 + - - - - version 1.5+ 5.0 + 6.0 + 5.0 + - 1 + - Warning , Deprecated H – HTML.title (Property) 1051 Event name JavaScript JScript N IE Opera DOM HTML Notes onClick 1.0 + 1.0 + 2.0 + 3.0 + 3.0 + - 4.0 + Warning onDblClick 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onHelp - 3.0 + - 4.0 + - - - Warning onKeyDown 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onKeyPress 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onKeyUp 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseDown 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseMove 1.2 + 3.0 + 4.0 + 4.0 + - - 4.0 + Warning onMouseOut 1.1 + 3.0 + 3.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseOver 1.0 + 1.0 + 2.0 + 3.0 + 3.0 + - 4.0 + Warning onMouseUp 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning Inheritance chain: Element object, Node object HTML.title (Property) The document title. Availability: JScript - 3.0 Internet Explorer - 4.0 Property/method value type: String primitive JavaScript syntax: IE myHTML.title HTML syntax: <TITLE>aTitle</TITLE> Argument list: aTitle A title text The DOM standard at level 1 requires that the title property of an HTML object should contain the text from the <TITLE> HTML tag in the<HEAD> block of the document. At least, this is the implication, because it refers the reader to the HTML specification, which defines that <TITLE>is only legal inside <HEAD> blocks. We can't really say this is part of the DOM specification, which unfortunately makes it ambiguous. Netscape makes this available as the document.title property, as does MSIE. However, MSIE does support this property as a member of the HTML object even though it is not mentioned in the Microsoft documentation. In Netscape, the title property of an HTML object exists but is empty, hence it cannot be guaranteed to be available in Netscape 6.0. See also: Document.title JavaScript Programmer's Reference 1052 HTML.version (Property) The version string of an HTML document. Availability: DOM level - 1 JavaScript - 1.5 JScript - 5.0 Internet Explorer - 5.0 Netscape - 6.0 Deprecated Property/method value type: String primitive JavaScript syntax: - myHTML.version HTML syntax: <HTML VERSION="aVersion"> Argument list: aVersion A version text This property is intended to hold the value of the VERSION=" " HTML tag attribute which is used in conjunction with the <HTML> tag. It has now been superseded by the <!DOCTYPE> DTD tag and is now deprecated. The MSIE browser does reflect this HTML tag into the version property, although it is not mentioned in the documentation. Warnings: ❑ This feature is deprecated in favor of placing aproperty DTD statement at the start of the document. HTML tag attribute (Definition) HTML tags have attributes, some of which can be accessed fromscripts. Earlier versions of the browsers required that HTML tag attributes were enclosed in double quotes. More recent browsers also allow the use of single quotes or even no quotes in some cases. This may be useful when enclosing fragments of JavaScript that contain quoted text strings. See also: Attribute object, Attributes object HTTP-EQUIV=" " (HTML Tag Attribute) The name attribute for a pseudo header item. Refer to: <META> H – http: URL (Request method) 1053 http: URL (Request method) A request from a web browser to a web server to send a document. This requests a document from a web server. Most web traffic isrequested this way. See also: javascript: URL, URL https: URL (Request method) A request from a web browser to a secure web server to send a document with an encrypted and secure protocol. Requests a document from a secure web server. Your encryption code needs to be compatible and this may involve an exchange of security certificates. See also: javascript: URL, Security policy, URL HyperLink (Definition) HyperLinks are references to documents served elsewhere. They may be pages, assets or includable files. See also: Anchor.href, BASE.href,IMG.href, Location.href, StyleSheet.href, HTML HyperLink object (Object/HTML) Another name for the Url object. Availability: JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Inherits from: Element object JavaScript syntax: - myHyperLink = myDocument.links[anIndex] Event handlers: onClick, onDblClick, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp In Netscape, links are stored in Url objects. These are distinctly different to Anchor objects. MSIE does not distinguish between the two but since there is no constructor, it is hard to know what object type they are. Generally they are assumed to be Url objects. JavaScript Programmer's Reference 1054 Because the class name is Url in Netscape, the link objects are discussed in detail under that lexical topic location. MSIE supports a LINK object class but this is a special object that stems from a styleSheet item. It doesn't support all the properties that a Url object does and is probably more concerned with managing the appearance of a Url object on the screen. See also: Area object, Element.all[], LinkArrayobject, URL, Urlobject Event name JavaScript JScript N IE Opera DOM HTML Notes onClick 1.0 + 1.0 + 2.0 + 3.0 + 3.0 + - 4.0 + Warning onDblClick 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onHelp - 3.0 + - 4.0 + - - - Warning onKeyDown 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onKeyPress 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onKeyUp 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseDown 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseMove 1.2 + 3.0 + 4.0 + 4.0 + - - 4.0 + Warning onMouseOut 1.1 + 3.0 + 3.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseOver 1.0 + 1.0 + 2.0 + 3.0 + 3.0 + - 4.0 + Warning onMouseUp 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning Inheritance chain: Element object, Node object [...]... ) case: default: , while( ) Cross-references: ECMA 262 edition 2 – section – 12 .5 ECMA 262 edition 2 – section – 12.6.1 ECMA 262 edition 3 – section – 12 .5 Wrox Instant JavaScript – page – 22 1063 JavaScript Programer's Reference if( ) else (Selector) A conditional execution mechanism Availability: JavaScript syntax: Argument list: ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet... object Property JavaScript JScript N IE Opera DOM HTML Notes align 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - Warning dataFld 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - Warning dataSrc 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - Warning frameBorder 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - Warning frameSpacing - 3.0 + - 4.0 + - - - Warning height 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - Warning hspace - 3.0 + - 4.0 + - - - Warning longDesc 1 .5 + - 6.0 + - -... marginHeight 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - Warning marginWidth 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - Warning Table continued on following page 1066 I – IFRAME.align (Property) Property JavaScript JScript N IE Opera DOM HTML Notes name 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - - noResize - 3.0 + - 4.0 + - - - - scrolling 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - - src 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - - tabIndex 6.0 + 4.0 + - 1+ - - 1 .5 + 3.0... - - Warning width 1 .5 + 3.0 + 6.0 + 4.0 + - 1+ - Warning Event name JavaScript JScript N IE Opera DOM HTML Notes onClick 1 .5+ 1.0 + 2.0 + 3.0 + 3.0 + - 4.0 + Warning onDblClick 1 .5+ 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onHelp - 3.0 + - 4.0 + - - - Warning onKeyDown 1 .5 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onKeyPress 1 .5 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onKeyUp 1 .5 + 3.0 + 4.0 + 4.0... Statement, switch( ) case: default: Cross-references: ECMA 262 edition 2 – section – 12 .5 ECMA 262 edition 3 – section – 12 .5 Wrox Instant JavaScript – page – 22 IFRAME object (Object/HTML) An object that represents an tag Availability: DOM level – 1 JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0 Inherits from: Element object JavaScript syntax: IE myIFRAME = myDocument.all.anElementID... remember that you are testing references to objects not values See also: Identically equal to (===), NOT Identically equal to (!==) ids (Property) An alternative reference to the document.ids property in JSS Availability: JavaScript – 1.2 Netscape – 4.0 Deprecated Property/method value type: Collection object JavaScript syntax: N ids N myDocument.ids 1061 JavaScript Programer's Reference Warnings: ❑ This... identical type Availability: ECMAScript edition – 3 JavaScript – 1.3 JScript – 1.0 Internet Explorer – 3.02 Netscape – 4.06 Property/method value type: Boolean primitive JavaScript syntax: - anOperand1 === anOperand2 anOperand1 A value of a comparable type anOperand2 A value of the same type as operand 1 Argument list: 1 057 JavaScript Programer's Reference The two operands are compared and the Boolean... 3.0 + - 4.0 + Warning onKeyUp 1 .5 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseDown 1 .5 + 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseMove 1 .5 + 3.0 + 4.0 + 4.0 + - - 4.0 + Warning onMouseOut 1 .5+ 3.0 + 3.0 + 4.0 + 3.0 + - 4.0 + Warning onMouseOver 1 .5 + 1.0 + 2.0 + 3.0 + 3.0 + - 4.0 + Warning onMouseUp 1 .5+ 3.0 + 4.0 + 4.0 + 3.0 + - 4.0 + Warning Inheritance chain: Element object, Node object... attribute that affects the alignment of the with respect to its parent object Availability: DOM level – 1 JavaScript – 1 .5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0 Property/method value type: String primitive JavaScript syntax: - myIFRAME.align 1067 JavaScript Programer's Reference The alignment of the IFRAME object with respect to its containing parent object is defined in this property... of the inline frame Availability: DOM level – 1 JavaScript – 1 .5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0 Property/method value type: String primitive JavaScript syntax: - myIFRAME.height The current height of the IFRAME can be measured from this property You ought to be able to modify it but it seems not to work 1069 JavaScript Programer's Reference Warnings: ❑ This appears to be a read-only . also: Document.title JavaScript Programmer's Reference 1 052 HTML.version (Property) The version string of an HTML document. Availability: DOM level - 1 JavaScript - 1 .5 JScript - 5. 0 Internet Explorer - 5. 0 Netscape. Element object Property JavaScript JScript N IE Opera DOM HTML Notes title - 3.0 + - 4.0 + - - - - version 1 .5+ 5. 0 + 6.0 + 5. 0 + - 1 + - Warning , Deprecated H – HTML.title (Property) 1 051 Event name JavaScript. Cross-references: ECMA 262 edition 2 – section – 12 .5 ECMA 262 edition 2 – section – 12.6.1 ECMA 262 edition 3 – section – 12 .5 Wrox Instant JavaScript – page – 22 JavaScript Programer's Reference 1064 if(

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