对了,小 span 的 class="templet" 是没的哈,
解决方案 »
- js表单验证问题
- 漂浮广告
- 求在一个<td></td>中 随着时间显示2张不同的图片
- 怎么用JS在框内实现上升和下移页面
- 我要new一个对象,这个对象里的一个属性要自动赋值为这个对象的变量名,能否实现?
- FireFox下不支持MSXML2.DOMDocument对象
- 我用window.print()想打印页面内某表格中的内容,而不是打印全部,该怎么做.
- 请问,如果我有一个AA页面调用了BB页面,当AA关闭后,再次打开时,如何能共享BB中的数据。
- 如何得到"<span id=name>3</span>"3这个值?document.all("name").?????
- Sha1函数
- 一个菜鸟的问题
- 最近发现很不错的一个效果
你这个点哪都会调用那个函数
但不是你说的这个点空白处
而是点任何地方都一样
也就是说点第一次的时候为改变 IMG 及 小SPAN 标签的 CSS 样式
点第二次时恢复,点第三次时改变 IMG 及 小SPAN 标签的 CSS 样式,第四次时恢复
如此循环
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>debug </title>
<style>
table,td{font: 12px/1.5 Tahoma, Helvetica, Arial, sans-serif;}
body{font: 12px/1.5 Tahoma, Helvetica, Arial, sans-serif;} .picCss{filter:Alpha(Opacity:50)}
.textCss{background:highlight;color:#ffffff;display:block;margin-top:5px ;width:60px;text-align: center;overflow: hidden;white-space:nowrap;text-overflow:ellipsis;} .templet{display:block;margin-top:5px ;width:60px;text-align: center;overflow: hidden;white-space:nowrap;text-overflow:ellipsis;}
</style>
<script language="JavaScript">
function css(obj)
{
for(var i=0;i<obj.childNodes.length;i++)
{
if(obj.childNodes[i].tagName)
{
if(obj.childNodes[i].tagName.toUpperCase()=="IMG")
obj.childNodes[i].className =obj.childNodes[i].className=="picCss"?"":"picCss"
else if(obj.childNodes[i].tagName.toUpperCase()=="SPAN")
obj.childNodes[i].className =obj.childNodes[i].className=="textCss"?"templet":"textCss"
}
}
}
</script>
</head> <body><span style="width:62px;height:75px;text-align:center;width: 60px;" onfocus="css(this)" onblur="css(this)"> <img src="images/templetFolder.gif" width="32" height="32"> <span class="templet">四川 </span> </span> <span style="width:62px;height:75px;text-align:center;width: 60px;" onfocus="css(this)" onblur="css(this)"> <img src="images/templetFolder.gif" width="32" height="32"> <span class="templet">休闲 </span> </span> <span style="width:62px;height:75px;text-align:center;width: 60px;" onfocus="css(this)" onblur="css(this)"> <img src="images/templetNode.gif" width="32" height="32"> <span class="templet">中心 </span> </span> <span style="width:62px;height:75px;text-align:center;width: 60px;" onfocus="css(this)" onblur="css(this)"> <img src="images/templetNode.gif" width="32" height="32"> <span class="templet">国家 </span> </span> </body>
</html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>debug</title>
<style>
table,td{font: 12px/1.5 Tahoma, Helvetica, Arial, sans-serif;}
body{font: 12px/1.5 Tahoma, Helvetica, Arial, sans-serif;} .picCss{filter:Alpha(Opacity:50)}
.textCss{background:highlight;color:#ffffff;display:block;margin-top:5px ;width:60px;text-align: center;overflow: hidden;white-space:nowrap;text-overflow:ellipsis;}
.ttt{color:#ff0000;}
</style><SCRIPT>
j=0;
function selectElement()
{
var el=event.srcElement;
var itemFlag=false;
var AllElement=document.body.getElementsByTagName('span');
for (var i=0;i<AllElement.length;i++){
if (el.parentElement==AllElement(i)){
itemFlag=true;
if (j!=0) AllElement[(j+1)].className='';AllElement[(j+1)].parentElement.children[0].className='';
if (el.tagName=='IMG') el.className='picCss';el.parentElement.children[1].className='textCss';
if (el.tagName=='SPAN') el.className='textCss';el.parentElement.children[0].className='picCss';
j=i;
}
if (itemFlag==false){
AllElement[i].className='';
AllElement[i].parentElement.children[0].className='';
}
}
}</SCRIPT>
</head><body onclick="selectElement();"><span style="width:62px;height:75px;text-align:center;width: 60px;"> <img src="images/templetFolder.gif" width="32" height="32"> <span style="display:block;margin-top:5px ;width:60px;text-align: center;overflow: hidden;white-space:nowrap;text-overflow:ellipsis;">四川 </span> </span> <span style="width:62px;height:75px;text-align:center;width: 60px;"> <img src="images/templetFolder.gif" width="32" height="32"> <span style="display:block;margin-top:5px ;width:60px;text-align: center;overflow: hidden;white-space:nowrap;text-overflow:ellipsis;">休闲 </span> </span> <span style="width:62px;height:75px;text-align:center;width: 60px;"> <img src="images/templetNode.gif" width="32" height="32"> <span style="display:block;margin-top:5px ;width:60px;text-align: center;overflow: hidden;white-space:nowrap;text-overflow:ellipsis;">中心 </span> </span> <span style="width:62px;height:75px;text-align:center;width: 60px;"> <img src="images/templetNode.gif" width="32" height="32"> <span style="display:block;margin-top:5px ;width:60px;text-align: center;overflow: hidden;white-space:nowrap;text-overflow:ellipsis;">国家 </span> </span> </body></html>
不信可以试试比如你还有别的元素div或者table你点这些一样触发