var myexample="";
var bnm="";
function flashit1(t)
{var bnm="myexample" + t;
bnm.style.borderColor="#cccccc";
}bnm无法得到myexample1,myexample2,myexample3,.。
var bnm="";
function flashit1(t)
{var bnm="myexample" + t;
bnm.style.borderColor="#cccccc";
}bnm无法得到myexample1,myexample2,myexample3,.。
解决方案 »
- 高手请进:如何让frameset里面的两个frame同时滚动
- 求助htc高手
- 求人揪错,下面这段脚本的应该怎么改才好
- 我想輸入用戶的ID後 換行自動帶出用戶其他的信息 於是想用onmouseover(),onmouseout() 調用****.do 實現對action類 ****.java 的操作, 查出用戶信息..... 請賜教 先謝謝了 !!!!!!!
- JavaScript 生成表格的语句里怎样设置行隐藏
- 如何用正刚表达式判断一组字符中是否包含<title></title>这样的字符。
- ckeditor和ckfinder组合的问题
- 不用层的话,javascript怎么实现这个简单的功能啊??
- 请问如何定制cookie使其向访问者发送特定的数据包。
- 咨询一个冒泡问题的解决办法
- 关于事件绑定的一些问题,谢谢!
- iframe设置filter:alpha(opacity=0);在ie8下完全透明,ie6下根本不透明
function getStyle(obj,which){
return obj.currentStyle?
obj.currentStyle[which]:
document.defaultView.getComputedStyle (obj,null)[which];
}
var obrderColor = getStyle(document.getElementById(元素的id));
你这里bnm是一个字符串,这还加神马样式?没见过这么玩的。
function o(t)
if t=1
myexample1.style.borderColor="#cccccc";if t=2
myexample2.style.borderColor="#cccccc";if t=3
myexample3.style.borderColor="#cccccc";...
function r(s)
if t=1
myexample1.style.borderColor="#cccccc";if t=2
myexample2.style.borderColor="#cccccc";if t=3
myexample3.style.borderColor="#cccccc";...如果太复杂,不如一个一个函数写的好?
if t=1
myexample1.style.borderColor="#cccccc";if t=2
myexample2.style.borderColor="#cccccc";if t=3
myexample3.style.borderColor="#cccccc";...
function r(s)
if s=1
myexample1.style.borderColor="#ffcccc";if s=2
myexample2.style.borderColor="#ffcccc";if s=3
myexample3.style.borderColor="#ffcccc";...
var bnm="";
function flashit1(t)
{eval("myexample" + t+".style.borderColor=\"#cccccc\");
}
function flashit1(t)
{var bnm="myexample" + t;
bnm.style.borderColor="#cccccc";
}function flashit2(s)
{var bnm="myexample" + s;
bnm.style.borderColor="#23B3DC";
}
<table width="60" border="0" cellpadding="0" cellspacing="0" id="myexample1" style="border:1px solid <%=bubgbg%>">
<tr>
<td height="20" bordercolor="#0099CC"> <div align="center"><a href="#" onmouseover="flashit1(1)" onmouseout="flashit2(1)">记录一</a></div></td>
</tr>
</table>
<table width="60" border="0" cellpadding="0" cellspacing="0" id="myexample2" style="border:1px solid <%=bubgbg%>">
<tr>
<td height="20" bordercolor="#0099CC"> <div align="center"><a href="#" onmouseover="flashit2(2)" onmouseout="flashit2(2)">记录二 </a></div></td>
</tr>
</table>
首先,你最好用style将bordercolor属性重写,而不要试图直接用html中的标签,(因为我没有这么做过),其次你的函数根本没有获取该对象,怎么能够取得或设置对象的属性呢,你需要用document.getElementById等函数取得某个对象,如
var document.getElementById(***).style.boderColor = ****
最后,直接使用style属性貌似只能改变内链样式,对于外链样式还另有一套方法,希望有点用function flashit1(t)
{var bnm="myexample" + t;
document.getElementById(bnm).style = "border:1px solid #cccccc";
//bnm.style.borderColor="#cccccc";
}