css javascript的问题getElementById.type.display
我在网上看到有人这样写:
getElementById("").style.display="none"
还有一个是getElementById("").attributes['class'].value = ''我查了下知道是通过Id得到display的属性和class的属性,我想问下,要得到display必须用.style吗?attributes是得到class,那我可以写成attributes['display']吗?attributes和style有什么区别?
给你看个示例,希望你能看明白
<div id="test" class="testCss" style="display:none;font-size:12px"> </div>
是否看明白了?
要得到display必须用.style吗?
恩
attributes是得到class,那我可以写成attributes['display']吗?
不可以
attributes和style有什么区别?
<td id="tdId" class="c1" style="display:none"> </td>
id,class,style都是属性
attributes是属性集合
通过getElementById("").attributes['style']能得到style属性
attributes是一个集合,得通过下标来访问(准确的说,是个map,通过key来访问)。
getElementById("").style
getElementById("").attributes['style']
我觉得这两种写法是一样的。
另外,目前流行的js框架,已经不需要写如此冗长的代码了,很方便。你可以试试。
谢谢你们,我茅塞顿开啊,尤其是2楼的回答
明白了就结贴散分吧,哈哈
Java code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.c
相关问答:
后台有一个函数 protected string Fun1(int a, string b)
我想在javascript代码中调用它,怎么做?
function GridBind()
{
var a = 1;
var b='s';
& ......
在javascript中,方法的返回(x,y)类型的值,应该怎样接收
返回(x,y)类型? 这是什么类型?
就像方法中,return (1,2)
我怎么没见过你说的这种写法?
直接接,js 是弱类型,接到后须自行处理!
......
如题,谢谢
1.用activeX
2.用服务器.传递命令给服务器,服务器来运行
javascript不可以吗
js是客户端执行的,权限有限,可以的话,病毒满天飞啦
是啊,如果可以的话,那 JavaScript 执行一个 format c: ......
各位大师讲解下,谢谢
不是很明确你要的是什么
LV GUCCI 香奈儿一比一包包 批发零售!
广州市天龙皮具厂成立于2002年。是一家有多年专业设计、生产、经营高档皮具系列产品的企业。主营LV,GUCCI,C ......