W3C
school
文檔首頁
HTML
CSS
Javascript
Python
jQuery
NodeJS
PHP
Java
MySQL
Express
More ?
開關
Javascript 官方文檔
Resource
Online
javascript教程
JavaScript 是世界上最流行的腳本語言。 JavaScript 是屬于 web 的語言,它適用于 PC、筆記本電腦、平板電腦和移動電話。 JavaScript 被設計為向 HTML 頁面增加交互性。 許多 HTML 開發者都不是程序員,但是 JavaScript 卻擁有非常簡單的語法。幾乎每個人都有能力將小的 JavaScript 片段添加到網頁中。
Official Website
Download
JavaScript and Browser Objects Quick Reference [.pdf]
JavaScript Cheat Sheet [.pdf]
JavaScript in one page
JavaScript Quick Reference Card [.pdf]
Related
AJAX
AJAX Cheat Sheet
CSS
CSS Cheat Sheet
GWT
GWT Cheat Sheet
HTML
HTML Cheat Sheet
HTML DOM
HTML DOM Cheat Sheet
jQuery
jQuery Cheat Sheet
MooTools
MooTools Cheat Sheet
Node.js
Node.js Cheat Sheet
Prototype
Prototype Cheat Sheet
XHTML
XHTML Cheat Sheet
Basic Objects
Array Properties
constructor
constructor 屬性返回對創建此對象的數組函數的引用。
length
Sets or returns the number of elements in an array
Array Methods
concat()
concat() 方法用于連接兩個或多個數組。 該方法不會改變現有的數組,而僅僅會返回被連接數組的一個副本。
indexOf()
indexOf() 方法可返回某個指定的字符串值在字符串中首次出現的位置。
join()
join() 方法用于把數組中的所有元素轉換一個字符串。
lastIndexOf()
lastIndexOf() 方法可返回一個指定的字符串值最后出現的位置,在一個字符串中的指定位置從后向前搜索。
pop()
pop() 方法用于刪除數組的最后一個元素并返回刪除的元素。
push()
push() 方法可向數組的末尾添加一個或多個元素,并返回新的長度。
reverse()
reverse() 方法用于顛倒數組中元素的順序。
shift()
shift() 方法用于把數組的第一個元素從其中刪除,并返回第一個元素的值。
slice()
slice() 方法可從已有的數組中返回選定的元素。
sort()
sort() 方法用于對數組的元素進行排序。
splice()
splice() 方法用于插入、刪除或替換數組的元素。
toString()
toString() 方法可把數組轉換為字符串,并返回結果。
unshift()
unshift() 方法可向數組的開頭添加一個或更多元素,并返回新的長度。
valueOf()
valueOf() 方法返回 Array 對象的原始值。
Boolean Properties
Boolean Methods
Math Properties
E
Returns Euler's number (approx. 2.718)
LN10
Returns the natural logarithm of 10 (approx. 2.302)
LN2
Returns the natural logarithm of 2 (approx. 0.693)
LOG10E
Returns the base-10 logarithm of E (approx. 0.434)
LOG2E
Returns the base-2 logarithm of E (approx. 1.442)
PI
Returns PI (approx. 3.14)
SQRT1_2
Returns the square root of 1/2 (approx. 0.707)
SQRT2
Returns the square root of 2 (approx. 1.414)
Math Methods
abs(x)
abs() 方法可返回一個數的絕對值。
acos(x)
acos() 方法可返回一個數的反余弦。返回的值是 0 到 PI 之間的弧度值。
asin(x)
asin() 方法返回-PI/2 到 PI/2 之間的弧度值。
atan(x)
atan() 方法以介于 -PI/2 與 PI/2 弧度之間的數值來返回 x 的反正切值。
atan2(y,x)
atan() 方法可返回數字的反正切值。
ceil(x)
ceil() 方法可對一個數進行上舍入。
cos(x)
cos() 方法可返回一個數字的余弦值。
exp(x)
exp() 方法可返回 e 的 x 次冪的值。E 為自然底數 (近似值 2.7183)。
floor(x)
floor() 方法返回小于等于x的最大整數。
log(x)
log() 方法可返回一個數的自然對數(基于E)。
max(x,y,z,...,n)
max() 方法可返回兩個指定的數中帶有較大的值的那個數。
min(x,y,z,...,n)
min() 方法可返回指定的數字中帶有最小值的數字。
pow(x,y)
pow() 方法返回 x 的 y 次冪。
random()
random() 方法可返回介于 0(包含) ~ 1(不包含) 之間的一個隨機數。
round(x)
round() 方法可把一個數字舍入為最接近的整數。
sin(x)
sin() 返回正弦值
sqrt(x)
sqrt() 方法可返回一個數的平方根。
tan(x)
tan() 方法可返回一個表示某個角的正切的數字。
Number Properties
MAX_VALUE
MAX_VALUE 屬性是 JavaScript 中可表示的最大的數。
MIN_VALUE
MIN_VALUE 屬性是 JavaScript 中可表示的最小的數(接近 0 ,但不是負數)。它的近似值為 5 x 10-324。
NEGATIVE_INFINITY
NEGATIVE_INFINITY 屬性表示負無窮大。
POSITIVE_INFINITY
POSITIVE_INFINITY 屬性值代表正無窮大。
Number Methods
toExponential(x)
toExponential() 方法可把對象的值轉換成指數計數法。
toFixed(x)
toFixed() 方法可把 Number 四舍五入為指定小數位數的數字。
toPrecision(x)
toPrecision() 方法可在對象的值超出指定位數時將其轉換為指數計數法。
String Properties
String Methods
charAt()
charAt() 方法可返回指定位置的字符。
charCodeAt()
charCodeAt() 方法可返回指定位置的字符的 Unicode 編碼。
fromCharCode()
fromCharCode() 可接受一個指定的 Unicode 值,然后返回一個字符串。
match()
match() 方法可在字符串內檢索指定的值,或找到一個或多個正則表達式的匹配。
replace()
replace() 方法用于在字符串中用一些字符替換另一些字符,或替換一個與正則表達式匹配的子串。
search()
search() 方法用于檢索字符串中指定的子字符串,或檢索與正則表達式相匹配的子字符串。
split()
split() 方法用于把一個字符串分割成字符串數組。
substr()
substr() 方法可在字符串中抽取從 開始 下標開始的指定數目的字符。
substring()
substring() 方法用于提取字符串中介于兩個指定下標之間的字符。
toLowerCase()
toLowerCase() 方法用于把字符串轉換為小寫。
toUpperCase()
toUpperCase() 方法用于把字符串轉換為大寫。
String HTML Wrapper Methods
anchor()
anchor() 方法用于創建 HTML 錨。
big()
big() 方法用于把字符串顯示為大號字體。
blink()
blink() 方法用于顯示閃動的字符串。
bold()
bold() 方法用于把字符串顯示為粗體。
fixed()
fixed() 方法用于把字符串顯示為打字機字體。
fontcolor()
fontcolor() 方法用于按照指定的顏色來顯示字符串。
fontsize()
fontsize() 方法用于按照指定的尺寸來顯示字符串。
italics()
italics() 方法用于把字符串顯示為斜體。
link()
link() 方法用于把字符串顯示為超鏈接。
small()
small() 方法用于把字符串顯示為小號字。
strike()
strike() 方法用于顯示加刪除線的字符串。
sub()
sub() 方法用于把字符串顯示為下標。
sup()
sup() 方法用于把字符串顯示為上標。
Global Properties
Infinity
Infinity 屬性用于存放表示正無窮大的數值。
NaN
NaN 屬性是代表非數字值的特殊值。該屬性用于指示某個值不是數字。
undefined
undefined 屬性用于存放 JavaScript 中未定義的值。
Global Methods
decodeURI()
decodeURI() 函數可對 encodeURI() 函數編碼過的 URI 進行解碼。
decodeURIComponent()
decodeURIComponent() 函數可對 encodeURIComponent() 函數編碼的 URI 進行解碼。
encodeURI()
encodeURI() 函數可把字符串作為 URI 進行編碼。
encodeURIComponent()
encodeURIComponent() 函數可把字符串作為 URI 組件進行編碼。
escape()
escape() 函數可對字符串進行編碼,這樣就可以在所有的計算機上讀取該字符串。
eval()
eval() 函數計算 JavaScript 字符串,并把它作為腳本代碼來執行。
isFinite()
isFinite() 函數用于檢查其參數是否是無窮大。
isNaN()
isNaN() 函數用于檢查其參數是否是非數字值。
Number()
Number() 函數把對象的值轉換為數字。
parseFloat()
parseFloat() 函數可解析一個字符串,并返回一個浮點數。
parseInt()
parseInt() 函數可解析一個字符串,并返回一個整數。
String()
String() 函數把對象的值轉換為字符串。
unescape()
unescape() 函數可對通過 escape() 編碼的字符串進行解碼。
Date Object
Date Properties
Date Methods
getDate()
getDate() 方法可返回月份的某一天。
getDay()
getDay() 方法可返回一周(0~6)的某一天的數字。
getFullYear()
getFullYear() 方法可返回一個表示年份的 4 位數字。
getHours()
getHours() 方法可返回時間的小時字段。
getMilliseconds()
getMilliseconds() 方法可返回時間的毫秒。(0-999)
getMinutes()
getMinutes() 方法可返回時間的分鐘字段。 (0-59)
getMonth()
getMonth() 方法可返回表示月份的數字。返回值是 0(一月) 到 11(十二月) 之間的一個整數。
getSeconds()
getSeconds() 方法可返回時間的秒。返回值是 0 ~ 59 之間的一個整數。
getTime()
getTime() 方法可返回距 1970 年 1 月 1 日之間的毫秒數。
getTimezoneOffset()
getTimezoneOffset() 方法可返回格林威治時間和本地時間之間的時差,以分鐘為單位。
getUTCDate()
getUTCDate() 方法可根據世界時返回一個月 (UTC) 中的某一天。 (1-31)
getUTCDay()
getUTCDay() 方法根據世界時返回表示星期的一天的一個數字。(0-6)
getUTCFullYear()
getUTCFullYear() 方法返回根據世界時 (UTC) 表示的四位數字年份。
getUTCHours()
getUTCHours() 方法可根據世界時 (UTC) 返回時間的小時。(0-23)
getUTCMilliseconds()
getUTCMilliseconds() 方法可根據世界時 (UTC) 返回時間的毫秒(0~999)。
getUTCMinutes()
getUTCMinutes() 方法可根據世界時 (UTC) 返回時間的分鐘字段(0~59)。
getUTCMonth()
getUTCMonth() 方法可返回一個表示月份的數字(按照世界時 UTC) (0-11)
getUTCSeconds()
getUTCSeconds() 方法可根據世界時返回時間的秒數(0~59)。
parse()
parse() 方法可解析一個日期時間字符串,并返回 1970/1/1 午夜距離該日期時間的毫秒數。
setDate()
setDate() 方法用于設置一個月的某一天。
setFullYear()
setFullYear() 方法用于設置年份。
setHours()
setHours() 方法用于設置指定的時間的小時字段。
setMilliseconds()
setMilliseconds() 方法用于設置指定時間的毫秒字段。
setMinutes()
setMinutes() 方法用于設置指定時間的分鐘字段。
setMonth()
setMonth() 方法用于設置月份。
setSeconds()
The setSeconds() 方法用于設置日期對象的秒字段。
setTime()
setTime() 方法以毫秒設置 Date 對象。
setUTCDate()
setUTCDate() 方法用于根據世界時 (UTC) 設置一個月中的某一天。
setUTCFullYear()
setUTCFullYear() 方法用于根據世界時 (UTC) 設置年份。
setUTCHours()
setUTCHours() 方法用于根據世界時 (UTC) 設置小時(0 - 23)。
setUTCMilliseconds()
setUTCMilliseconds() 方法用于根據世界時 (UTC) 設置指定時間的毫秒。
setUTCMinutes()
setUTCMinutes() 方法用于根據世界時 (UTC) 來設置指定時間的分鐘。
setUTCMonth()
setUTCMonth() 方法用于根據世界時 (UTC) 來設置月份。
setUTCSeconds()
setUTCSeconds() 方法用于根據世界時 (UTC) 設置指定時間的秒字段。
toDateString()
toDateString() 方法可把 Date 對象的日期部分轉換為字符串,并返回結果。
toISOString()
toISOString() 方法可以使用ISO標準將 Date 對象轉換為字符串。
toJSON()
toJSON() 方法可以將 Date 對象轉換為字符串,并格式化為 JSON 數據格式。
toLocaleDateString()
toLocaleDateString() 方法可根據本地時間把 Date 對象的日期部分轉換為字符串,并返回結果。
toLocaleString()
toLocaleString() 方法可根據本地時間把 Date 對象轉換為字符串,并返回結果。
toLocaleTimeString()
toLocaleTimeString() 方法可根據本地時間把 Date 對象的時間部分轉換為字符串,并返回結果。
toTimeString()
toTimeString() 方法可把 Date 對象的時間部分轉換為字符串,并返回結果。
toUTCString()
toUTCString() 方法可根據世界時 (UTC) 把 Date 對象轉換為字符串,并返回結果。
UTC()
UTC() 方法可根據世界時返回 1970 年 1 月 1 日 到指定日期的毫秒數
Browser
Window Properties
closed
closed 屬性可返回一個布爾值,該值聲明了窗口是否已經關閉。
defaultStatus
defaultStatus 屬性可設置或返回窗口狀態欄中的默認文本。該屬性可讀可寫。
document
Returns the Document object for the window
frames
frames 屬性返回窗口中所有命名的框架。
history
Returns the History object for the window
innerHeight
innerheight 返回窗口的文檔顯示區的高度。
innerWidth
innerwidth 返回窗口的文檔顯示區的寬度。
location
Returns the Location object for the window
name
Sets or returns the name of a window
navigator
返回 Navigator 對象
opener
opener 屬性是一個可讀可寫的屬性,可返回對創建該窗口的 Window 對象的引用。
outerHeight
outerHeight屬性設置或返回一個窗口的外部高度,包括所有界面元素(如工具欄/滾動條)。
outerWidth
outerWidth屬性設置或返回窗口的外部寬度,包括所有的界面元素(如工具欄/滾動)。
pageXOffset
pageXOffset 設置或返回當前頁面相對于窗口顯示區左上角的 X 位置。
pageYOffset
pageYOffset 設置或返回當前頁面相對于窗口顯示區左上角的 Y 位置。
parent
parent屬性返回當前窗口的父窗口。
screen
Returns the Screen object for the window
screenLeft
Returns the x coordinate of the window relative to the screen
screenTop
Returns the y coordinate of the window relative to the screen
screenX
Returns the x coordinate of the window relative to the screen
screenY
Returns the y coordinate of the window relative to the screen
self
Returns the current window
status
Sets the text in the statusbar of a window
top
Returns the topmost browser window
Window Methods
alert()
alert() 方法用于顯示帶有一條指定消息和一個 確認 按鈕的警告框。
blur()
blur() 方法可把鍵盤焦點從頂層窗口移開。
clearInterval()
clearInterval() 方法可取消由 setInterval() 設置的 timeout。
clearTimeout()
clearTimeout() 方法可取消由 setTimeout() 方法設置的 timeout。
close()
Closes the current window
confirm()
confirm()方法用于顯示一個帶有指定消息和確認及取消按鈕的對話框。
focus()
focus() 方法用于為元素設置焦點(如果可以設置)。
moveBy()
moveBy() 方法可相對窗口的當前坐標把它移動指定的像素。
moveTo()
moveTo() 方法可把窗口的左上角移動到一個指定的坐標。
open()
open() 方法用于打開一個新的瀏覽器窗口或查找一個已命名的窗口。
print()
print() 方法用于打印當前窗口的內容。
prompt()
prompt()方法用于顯示可提示用戶進行輸入的對話框。
resizeBy()
resizeBy() 方法用于根據指定的像素來調整窗口的大小。
resizeTo()
方法用于把窗口大小調整為指定的寬度和高度。
scrollBy()
scrollBy() 方法可把內容滾動指定的像素數。
scrollTo()
scrollTo() 方法可把內容滾動到指定的坐標。
setInterval()
setInterval() 方法可按照指定的周期(以毫秒計)來調用函數或計算表達式。
setTimeout()
setTimeout() 方法用于在指定的毫秒數后調用函數或計算表達式。
Navigator Properties
appCodeName
Returns the code name of the browser
appName
Returns the name of the browser
appVersion
Returns the version information of the browser
cookieEnabled
Determines whether cookies are enabled in the browser
platform
Returns for which platform the browser is compiled
userAgent
Returns the user-agent header sent by the browser to the server
Navigator Methods
javaEnabled()
Specifies whether or not the browser has Java enabled
registerContentHandler()
registerProtocolHandler()
Screen Properties
availHeight
Returns the height of the screen (excluding the Windows Taskbar)
availWidth
Returns the width of the screen (excluding the Windows Taskbar)
colorDepth
Returns the bit depth of the color palette for displaying images
height
Returns the total height of the screen
pixelDepth
Returns the color resolution (in bits per pixel) of the screen
width
Returns the total width of the screen
History Properties
History Methods
back()
back() 方法可加載歷史列表中的前一個 URL(如果存在)。
forward()
forward() 方法可加載歷史列表中的下一個 URL。
go()
go() 方法可加載歷史列表中的某個具體的頁面。
Location Properties
hash
hash 屬性是一個可讀可寫的字符串,該字符串是 URL 的錨部分(從 # 號開始的部分)。
host
host 屬性是一個可讀可寫的字符串,可設置或返回當前 URL 的主機名稱和端口號。
hostname
hostname 屬性是一個可讀可寫的字符串,可設置或返回當前 URL 的主機名。
href
href 屬性是一個可讀可寫的字符串,可設置或返回當前顯示的文檔的完整 URL。
pathname
pathname 屬性是一個可讀可寫的字符串,可設置或返回當前 URL 的路徑部分。
port
port 屬性是一個可讀可寫的字符串,可設置或返回當前 URL 的端口部分。
protocol
protocol 屬性是一個可讀可寫的字符串,可設置或返回當前 URL 的協議。
search
search 屬性是一個可讀可寫的字符串,可設置或返回當前 URL 的查詢部分(問號 ? 之后的部分)。
Location Methods
assign()
assign()方法加載一個新的文檔。
reload()
reload()方法用于刷新當前文檔。
DOM Events
Mouse Events
click
The event occurs when the user clicks on an element
dblclick
The event occurs when the user double-clicks on an element
mousedown
The event occurs when a user presses a mouse button over an element
mousemove
The event occurs when a user moves the mouse pointer over an element
mouseout
The event occurs when a user moves the mouse pointer out of an element
mouseover
The event occurs when a user mouse over an element
mouseup
The event occurs when a user releases a mouse button over an element
Keyboard Events
keydown
The event occurs when the user is pressing a key or holding down a key
keypress
The event occurs when the user is pressing a key or holding down a key
keyup
The event occurs when a keyboard key is released
Frame Events
abort
load
The event occurs when a document, frameset, or <object> has been loaded
resize
The event occurs when a document view is resized
unload
The event occurs when a document is removed from a window or frame (for <body> and <frameset>)
Form Events
onsubmit
blur
The event occurs when a form element loses focus
change
The event occurs when the content of a form element, the selection, or the checked state have changed (for <input>, <select>, and <textarea>)
focus
The event occurs when an element gets focus (for <label>, <input>, <select>, textarea>, and <button>)
select
The event occurs when a user selects some text (for <input> and <textarea>)
Event Object Constant
AT_TARGET
BUBBLING_PHASE
CAPTURING_PHASE
Event Object Properties
bubbles
Returns whether or not an event is a bubbling event
cancelable
Returns whether or not an event can have its default action prevented
currentTarget
Returns the element whose event listeners triggered the event
target
Returns the element that triggered the event
timeStamp
Returns the time (in milliseconds relative to the epoch) at which the event was created
type
Returns the name of the event
Event Object Methods
initEvent()
preventDefault()
stopPropagation()
EventTarget Object
addEventListener()
removeEventListener()
dispatchEvent()
EventListener Object
handleEvent()
MouseEvent/KeyboardEvent Object
keyIdentifier
altKey
Returns whether or not the
button
Returns which mouse button was clicked when an event was triggered
clientX
Returns the horizontal coordinate of the mouse pointer, relative to the current window, when an event was triggered
clientY
Returns the vertical coordinate of the mouse pointer, relative to the current window, when an event was triggered
ctrlKey
Returns whether or not the
metaKey
Returns whether or not the
relatedTarget
Returns the element related to the element that triggered the event
shiftKey
Returns whether or not the
MouseEvent/KeyboardEvent Methods
initKeyboardEvent()
initMouseEvent()
DOM Node
Node Properties
attributes
Returns a collection of a node's attributes
baseURI
Returns the absolute base URI of a node
childNodes
Returns a NodeList of child nodes for a node
firstChild
Returns the first child of a node
lastChild
Returns the last child of a node
localName
Returns the local part of the name of a node
namespaceURI
Returns the namespace URI of a node
nextSibling
Returns the next node at the same node tree level
nodeName
Returns the name of a node, depending on its type
nodeType
Returns the type of a node
nodeValue
Sets or returns the value of a node, depending on its type
ownerDocument
Returns the root element (document object) for a node
parentNode
Returns the parent node of a node
prefix
Sets or returns the namespace prefix of a node
previousSibling
Returns the previous node at the same node tree level
textContent
Sets or returns the textual content of a node and its descendants
Node Methods
setUserData(key,data,handler)
appendChild()
Adds a new child node, to the specified node, as the last child node
cloneNode()
Clones a node
compareDocumentPosition()
Compares the document position of two nodes
getFeature(
feature
,
version
)
hasAttributes()
Returns true if a node has any attributes, otherwise it returns false
hasChildNodes()
Returns true if a node has any child nodes, otherwise it returns false
insertBefore()
Inserts a new child node before a specified, existing, child node
isDefaultNamespace()
Returns true if the specified namespaceURI is the default, otherwise false
isEqualNode()
Checks if two nodes are equal
isSameNode()
Checks if two nodes are the same node
isSupported()
Returns true if a specified feature is supported on a node, otherwise false
lookupNamespaceURI()
Returns the namespace URI matching a specified prefix
lookupPrefix()
Returns the prefix matching a specified namespace URI
normalize()
Joins adjacent text nodes and removes empty text nodes
removeChild()
Removes a child node
replaceChild()
Replaces a child node
Node Types
DocumentType
10
DocumentFragment
11
CDATASection
4
Comment
8
Notation
12
ProcessingInstruction
7
Attr
2
Element
1
EntityReference
5
Entity
6
Text
3
Document
9
nodeName Returns
Attr
attribute name
CDATASection
#cdata-section
Comment
#comment
DocumentFragment
#document fragment
DocumentType
doctype name
Element
element name
Entity
entity name
EntityReference
entity reference name
Notation
notation name
ProcessingInstruction
target
Text
#text
nodeValue Returns
RegExp
Modifiers
g
Perform a global match (find all matches rather than stopping after the first match)
i
Perform case-insensitive matching
m
Perform multiline matching
Brackets
(red|blue|green)
Find any of the alternatives specified
[^abc]
Find any character not between the brackets
[^adgk]
Find any character outside the given set
[0-9]
Find any digit from 0 to 9
[A-Z]
Find any character from uppercase A to uppercase Z
[abc]
Find any character between the brackets
[adgk]
Find any character in the given set
Metacharacters
.
Find a single character, except newline or line terminator
\0
Find a NUL character
\b
Find a match at the beginning/end of a word
\d
Find a digit
\f
Find a form feed character
\n
Find a new line character
\r
Find a carriage return character
\s
Find a whitespace character
\t
Find a tab character
\uxxxx
Find the Unicode character specified by a hexadecimal number xxxx
\v
Find a vertical tab character
\w
Find a word character
\xdd
Find the character specified by a hexadecimal number dd
\xxx
Find the character specified by an octal number xxx
Quantifiers
^n
Matches any string with n at the beginning of it
?!n
Matches any string that is not followed by a specific string n
?=n
Matches any string that is followed by a specific string n
n?
Matches any string that contains zero or one occurrences of n
n{X,}
Matches any string that contains a sequence of at least X <i>n</i>'s
n{X,Y}
Matches any string that contains a sequence of X to Y <i>n</i>'s
n{X}
Matches any string that contains a sequence of <i>X</i> <i>n</i>'s
n*
Matches any string that contains zero or more occurrences of n
n+
Matches any string that contains at least one n
n$
Matches any string with n at the end of it
RegExp Properties
global
Specifies if the
ignoreCase
Specifies if the
lastIndex
The index at which to start the next match
multiline
Specifies if the
source
The text of the RegExp pattern
RegExp Methods
exec()
exec() 方法用于檢索字符串中的正則表達式的匹配
test()
Tests for a match in a string. Returns true or false
Core DOM
Nodelist Properties
Nodelist Methods
item()
Returns the node at the specified index in a node list
NamedNodeMap Properties
NamedNodeMap Methods
setNamedItemNS()
getNamedItem()
Returns the specified node (by name)
removeNamedItem()
Removes the specified node (by name)
setNamedItem()
Sets the specified node (by name)
Document Properties
doctype
Returns the Document Type Declaration associated with the document
documentElement
Returns the Document Element of the document (the HTML element)
documentURI
Sets or returns the location of the document
implementation
Returns the DOMImplementation object that handles this document
inputEncoding
Returns the encoding, character set, used for the document
xmlEncoding
Returns the XML encoding of the XML document
xmlVersion
Sets or returns the XML version of the XML document
Document Methods
createProcessingInstruction()
normalizeDocument()
createAttribute()
Creates an attribute node
createCDATASection()
Creates a CDATA node with the specified text. For XML DOM only
createComment()
Creates a Comment node with the specified text
createDocumentFragment()
Creates an empty DocumentFragment node
createElement()
Creates an Element node
createEntityReference()
Creates an EntityReference node. For XML DOM only
createTextNode()
Creates a Text node
getElementById()
Returns the element that has the ID attribute with the specified value
getElementsByName()
Returns a list of elements with a given name in the (X)HTML document.
getElementsByTagName()
Returns a NodeList containing all elements with the specified tagname
getElementsByTagNameNS()
Returns a NodeList containing all elements with the specified namespaceURI and tagname
importNode()
Imports a node from another document
querySelector()
Returns the first element matching the specified CSS selector
querySelectorAll()
Returns a NodeList containing all elements that match the specified CSS selector
Element Properties
tagName
Returns the tag name of the element
Element Methods
getAttribute()
Returns the specified attribute value
getAttributeNode()
Returns the specified attribute node
getAttributeNodeNS()
Returns the specified attribute node, with the specified namespace. For XML DOM only
getAttributeNS()
Returns the specified attribute value, with the specified namespace. For XML DOM only
hasAttribute()
Returns true if the element has the specified attribute, otherwise it returns false
hasAttributeNS()
Returns true if the element has the specified attribute, with the specified namespace, otherwise it returns false. For XML DOM only
removeAttribute()
Removes the specified attribute
removeAttributeNode()
Removes the specified attribute node, and returns the removed node
removeAttributeNS()
Removes the attribute with the specified name and namespace. For XML DOM only
setAttribute()
Sets or changes the specified attribute, to the specified value
setAttributeNode()
Sets or changes the specified attribute node
setAttributeNodeNS()
Sets or changes the specified attribute node
setAttributeNS()
Sets or changes the specified attribute, with the specified namespace, to the specified value. For XML DOM only
setIdAttribute()
setIdAttributeNode()
setIdAttributeNS()
Attr Properties
isId
Returns
ownerElement
Returns the element this attribute belongs to
specified
Returns
value
Sets or returns the value of the attribute
Graphics
CanvasRenderingContext2D Methods
arc()
arc() 方法創建弧/曲線(用于創建圓或部分圓)。
arcTo()
arcTo() 方法在畫布上創建介于兩個切線之間的弧/曲線。
beginPath()
beginPath() 方法開始一條路徑,或重置當前的路徑。
bezierCurveTo()
bezierCurveTo() 方法通過使用表示三次貝塞爾曲線的指定控制點,向當前路徑添加一個點。
clearRect()
clearRect() 方法清空給定矩形內的指定像素。
clip()
clip()方法從原始畫布中剪切任意形狀和尺寸。
closePath()
closePath() 方法創建從當前點到開始點的路徑。
createImageData()
createImageData() 方法創建新的空白 ImageData 對象。新對象的默認像素值 transparent black。
createLinearGradient()
createLinearGradient() 方法創建線性的漸變對象。
createPattern()
createPattern() 方法在指定的方向內重復指定的元素。
createRadialGradient()
createRadialGradient() 方法創建放射狀/圓形漸變對象。
drawCustomFocusRing()
boolean drawCustomFocusRing(Element element);
drawImage()
drawImage() 方法在畫布上繪制圖像、畫布或視頻。
drawSystemFocusRing()
void drawSystemFocusRing(Element element);
fill()
fill() 方法填充當前的圖像(路徑)。默認顏色是黑色。
fillRect()
fillRect() 方法繪制"已填充"的矩形。默認的填充顏色是黑色。
fillText()
fillText() 方法在畫布上繪制填色的文本。文本的默認顏色是黑色。
getImageData()
getImageData() 方法返回 ImageData 對象,該對象拷貝了畫布指定矩形的像素數據。
getLineDash()
Returns an dash list array containing an even number of non-negative numbers.
isPointInPath()
如果指定的點位于當前路徑中,isPointInPath() 方法返回 true,否則返回 false。
lineTo()
lineTo() 方法添加一個新點,然后創建從該點到畫布中最后指定點的線條(該方法并不會創建線條)。
measureText()
measureText()方法返回一個對象,該對象包含以像素計的指定字體寬度。
putImageData()
putImageData() 方法將圖像數據(從指定的 ImageData 對象)放回畫布上。
quadraticCurveTo()
quadraticCurveTo() 方法通過使用表示二次貝塞爾曲線的指定控制點,向當前路徑添加一個點。
rect()
rect() 方法創建矩形。
restore()
Restores the drawing style state to the last element on the 'state stack' saved by save()
rotate()
rotate() 方法旋轉當前的繪圖。
save()
Saves the current drawing style state using a stack so you can revert any change you make to it using restore().
scale()
scale() 方法縮放當前繪圖至更大或更小。
scrollPathIntoView()
void scrollPathIntoView();
setLineDash()
void setLineDash( sequence segments );
setTransform()
setTransform() 方法把當前的變換矩陣重置為單位矩陣,然后以相同的參數運行 transform()。
stroke()
stroke() 方法會實際地繪制出通過 moveTo() 和 lineTo() 方法定義的路徑。默認顏色是黑色。
strokeRect()
strokeRect() 方法繪制矩形(無填充)。筆觸的默認顏色是黑色。
strokeText()
strokeText() 方法在畫布上繪制文本(無填充色)。文本的默認顏色是黑色。
transform()
transform() 方法替換當前的變換矩陣。
translate()
translate() 方法重新映射畫布上的 (0,0) 位置。
一本一道精品欧美中文字幕_欧美人与动ⅩXXXZOOZ_亚洲Aⅴ在线无码播放毛片一线天_99偷拍视频精品一区二区
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
|
<蜘蛛词>
| <文本链> <文本链> <文本链> <文本链> <文本链> <文本链>