javascrip取得比如<tr>的class的信息比如background? 取style可以、取class不容易吧。等待高手。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 docment.getElementById("trid").style.background 一樓説說的對阿,style容易,class不容易啊 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>testCSS</title></head><body><span style="background-color:#006666; font-size:18px; color:#0033CC;"><span id="s1">TEST TEXT</span></span><script language="javascript"> var v = document.getElementById("s1"); var vStyle = v.currentStyle || document.defaultView.getComputedStyle(v,null); //兼容IE6,IE7,FireFox alert(vStyle.backgroundColor + "\n" + vStyle.color);</script></body></html> 都可以取到,看debugger中的quickwatchdocment.getElementById("trid")..style.color="red";docment.getElementById("trid").style.background ="red"; 你们在标签里用class引用css不要直接用style看看再说.. 何实现随鼠标移到切换到对应的内容 .js+数字 用于验证的问题 想实现通过选择同一组的不同radio button,实现不同页面的跳转。 谁知道用JavaScript如何攫取其他URL页面内容啊?? 只为了更懒 求支持拖拽的数据库版树(TREE), 一个菜单用window.createPopup();实现的问题? javascript和seesion “没有权限”的问题(我的项目中一个重要的问题) 表头如何固定 pobj.appendChild(obj)问题 各位有没有学习javascript高级技巧的教程?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>testCSS</title>
</head>
<body>
<span style="background-color:#006666; font-size:18px; color:#0033CC;"><span id="s1">TEST TEXT</span></span>
<script language="javascript">
var v = document.getElementById("s1");
var vStyle = v.currentStyle || document.defaultView.getComputedStyle(v,null); //兼容IE6,IE7,FireFox
alert(vStyle.backgroundColor + "\n" + vStyle.color);
</script>
</body>
</html>
docment.getElementById("trid")..style.color="red";
docment.getElementById("trid").style.background ="red";