页面中一个id为price的层,使用id选择器设置层price的样式,在IE浏览器中运行此页面,下列代码中,()能正确获取层的背景颜色。
A: document.getElementById("price").currentStyle.backgroundColor
B: document.getElementById("price").currentStyle.background-color
C: document.getElementById("price").style.backgroundColor
D: var divObj=document.getElementById("price");document.defaultView.getComputedStyle(divObj,null).background;
A: document.getElementById("price").currentStyle.backgroundColor
B: document.getElementById("price").currentStyle.background-color
C: document.getElementById("price").style.backgroundColor
D: var divObj=document.getElementById("price");document.defaultView.getComputedStyle(divObj,null).background;
举一反三
- 页面中有一个ID为price的层,并且有一个ID选择器price用来设置层price的样式,在IE浏览器中运行此页面,下面()能正确获取层的背景颜色. A: document.getElementById(“price”).currentStyle.backgroundColor B: document.getElementById(“price”).style.backgroundColor C: document.getElementById(“price”).currentStyle.background-color D: document.getElementById(“price”)
- 页面中有一个id为price的层,使用id选择器设置层price的样式,在IE浏览器中运行此页面,下列代码中,()能正确获取层的背景颜色
- 页面中有一个id为price的层,并且有一个id选择器price用来设置层price的样式,在IE浏览器中运行此页面,下面()能正确获取层的背景颜色
- 在JS中,通过document对象下的getElementById()方式用ID获取元素。()
- 为获取页面中多个同名对象,应使用document的()方法; A: getElementById() B: getElementsByName() C: getElementsByTagName()