JavaScript保留關鍵字及危險變數名

來源:互聯網
上載者:User

JavaScript保留關鍵字及危險變數名 定義變數名需謹慎

在開發過程當中,如果沒有必要就儘可能少的使用以下列出的單詞作為變數名稱或者屬性名稱,關鍵字是嚴格不允許,而瀏覽器定義的變數名或者類名在使用的時候注意確保範圍

一、現在 EMCAScript 中的關鍵字:

break case catch continue
default delete do else
finally for function if
in instanceof new return
switch this throw try
typeof var void while
with      

二、將來EMCAScript 5中可能使用的關鍵字:

abstract boolean byte char
class debugger double enum
extends final float goto
implements int interface long
native package private protected
public short static super
synchronized throws transient volatile

三、 JavaScript2.0(future) 不明確提到的關鍵字:

as const export import
is use    

四、絕大部分瀏覽器中預定義的一些變數名和類名:

Anchor anchors Applet applets
Area Array Body Button
Checkbox Date document Error
EvalError FileUpload Form forms
frame frames Function Hidden
History history Image images
Link links location Math
MimeType mimetypes navigator Number
Object Option options Password
Plugin plugins Radio RangeError
ReferenceError RegExp Reset screen
Script Select String Style
StyleSheet Submit SyntaxError Text
Textarea TypeError URIError window

五、全域屬性及方法:

Infinity NaN undefined decodeURI
decodeURIComponent encodeURI encodeURIComponent escape
eval isFinite isNaN parseFloat
parseInt unescape    

六、Window對象的屬性和方法:

1、property:

closed Components content controllers
defaultStatus directories document frames
history innerHeight innerWidth length
location locationbar menubar name
navigator opener outerHeight outerWidth
pageXOffset pageYOffset parent personalbar
pkcs11 prompter screen screenX
screenY scrollbars scrollX scrollY
self statusbar toolbar top
window      

2、Methods:

alert back blur captureevents
clearInterval clearTimeout close confirm
dump escape focus forward
getAttention getSelection home moveBy
moveTo open print prompt
releaseevents resizeBy resizeTo scroll
scrollBy scrollByLines scrollByPages scrollTo
setCursor setInterval setTimeout sizeToContents
stop unescape updateCommands  

七、事件:

onabort onblur onchange onclick
onclose ondragdrop onerror onfocus
onkeydown onkeypress onkeyup onload
onmousedown onmousemove onmouseout onmouseover
onmouseup onpaint onreset onresize
onscroll onselect onsubmit onunload

八、特定瀏覽器中預定義的變數名和類名:

all assign clientInformation element
embed embeds event frameRate
getClass java JavaArray JavaClass
JavaObject JavaPackage layer layers
netscape offscreenBuffering opener packages
secure status sun taint
toSource toString untaint valueOf

原文地址:http://www.qianduanzu.com/2012033020.html

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.