在JavaScript中,下面()能实现当鼠标移至文本上时,字体大小改变。(选择一项)
a) <div onmouseover=”this.style.font-size=’18px’” 
          onmouseout=”this.style.font-size=’12px’”>coffee</div>b) <div onmouseover=”this.style.fontSize=’18px’”
          onmouseout=”this.style.fontSize=’12px’”>coffee</div>c) <div onmouseover=”fontSize=’18px’” onmouseout=” 
          fontSize=’12px’”>coffee</div>d) <div onmouseover=”font-size=’18px’” 
          onmouseout=”font-size=’12px’”>coffee</div>

   这里this.style.font-size=’18px’
        this.style.fontSize=’18px’
         fontSize=’18px’
         font-size=’18px’表示什么意思???????

解决方案 »

  1.   

    B font-size=’18px’这种是错误的写法 。
      

  2.   

    css里你写成font-size:18px没问题,程序里写应该 dom.style.fontSize='18px' 引号不能省,'px'不能省
      

  3.   

      (1)this.style.font-size=’18px’
      (2)this.style.fontSize=’18px’
      (3)fontSize=’18px’
      (4)font-size=’18px’ (1)(2)(3)(4)个表示什么意思啊??????
      

  4.   

    <div onmouseover='this.style.fontSize="18px"'  onmouseout='this.style.fontSize="12px"'>coffee</div>
      

  5.   

    (2)是正确答案。
    首先可以排除(1)(4),因为font-size是CSS里面的写法,在JS里要写成fontSize,就像CSS里的background-color在JS里也要写成backgroundColor。又因为JS里所有关于CSS属性的改变前面都要加style,所以选(2).