js中属性操作不允许出现-(横杠)
例如 fontSize不能写成font-size
paddingTop不能写成padding-top
maginLeft不能写成magin-left
动态修改样式 className
oP.style.width='100px'
oP.style.height='100px'
oP.style.background='red'
可以写成下面的方式
.red{width:100px; height:100px; background:red}
oP.className='red'
在js中class是关键字不可以用,用className替换
常见的关键字有:
break delete function return typeof
case do if switch var
catch else in this void
continue false instanceof throw while
debugger finally new true with
default for null try
常见的保留字有:
abstract double goto native static
boolean enum implements package super
byte export import private synchronized
char extends int protected throws
class final interface public transient
const float long short volatile