js改变字体

JavaScript020

js改变字体,第1张

link.onmouseover = function(){

    if(!this.font){

        var font = this.currentStyle ? this.currentStyle.font : getComputedStyle(this, false).font

        this.font = font

    }

    this.style.font = "bolder 22px consolas"

}

link.onmouseout = function(){

    this.style.font = this.font

}

把这一句

#content p span{color:redfont:bold 20px Arial}

修改成这样,

其中color是字体颜色 font:20px是字体大小:

#content p span{color:#999font:bold 20px Arial}