61,115
社区成员
发帖
与我相关
我的任务
分享
<table width="42" height="12" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="14" height="12" style="background-image:url(img/1.gif);"> </td>
<td width="14" height="12" style="background-image:url(img/1.gif)"> </td>
<td width="14" height="12" style="background-image:url(img/1.gif)"> </td>
</tr>
</table>
<script>
var tds = document.getElementsByTagName('td');
for(var i = 0; i < tds.length; i++){
tds[i].onclick = function(){
if(document.all){
if(this.style.backgroundImage == 'url(img/2.gif)'){
this.style.backgroundImage = 'url(img/1.gif)';
}else{
this.style.backgroundImage = 'url(img/2.gif)';
}
}else{
if(this.style.backgroundImage == 'url("img/2.gif")'){
this.style.backgroundImage = 'url("img/1.gif")';
}else{
this.style.backgroundImage = 'url("img/2.gif")';
}
}
};
}
</script>
<table width="42" height="12" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="14" height="12" style="background-image:url(img/1.gif);" onclick= "this.style.background=this.style.backgroundImage=='url(img/2.gif)'?'url(img/1.gif)':'url(img/2.gif)'"> </td>
<td width="14" height="12" style="background-image:url(img/1.gif)" onclick= "this.style.background=this.style.backgroundImage=='url(img/2.gif)'?'url(img/1.gif)':'url(img/2.gif)'"> </td>
<td id="a" width="14" height="12" style="background-image:url(img/1.gif)" onclick= "this.style.background=this.style.backgroundImage=='url(img/2.gif)'?'url(img/1.gif)':'url(img/2.gif)'"> </td>
</tr>
</table>
<script>
var tds = document.getElementsByTagName('td');
for(var i = 0; i < tds.length; i++){
tds[i].onclick = function(){
if(document.all){
if(this.style.backgroundImage == 'url(img/2.gif)'){
this.style.backgroundImage = 'url(img/1.gif)';
}else{
this.style.backgroundImage = 'url(img/2.gif)';
}
}else{
if(this.style.backgroundImage == 'url("img/2.gif")'){
this.style.backgroundImage = 'url("img/1.gif")';
}else{
this.style.backgroundImage = 'url("img/2.gif")';
}
}
};
}
</script>
<table width="42" height="12" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="14" height="12" style="background:url(img/1.gif)" onclick= "this.style.background=this.style.background=='img/2.gif'?'img/1.gif':'img/2.gif'"> </td>
<td width="14" height="12" style="background:url(img/1.gif)" onclick= "this.style.background=this.style.background=='img/2.gif'?'img/1.gif':'img/2.gif'"> </td>
<td width="14" height="12" style="background:url(img/1.gif)" onclick= "this.style.background=this.style.background=='img/2.gif'?'img/1.gif':'img/2.gif'"> </td>
</tr>
</table>
<table width="42" height="12" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="14" height="12" background="img/1.gif" onclick= "this.style.background=this.style.background=='img/2.gif'?'img/1.gif':'img/2.gif'"> </td>
<td width="14" height="12" background="img/1.gif" onclick= "this.style.background=this.style.background=='img/2.gif'?'img/1.gif':'img/2.gif'"> </td>
<td width="14" height="12" background="img/1.gif" onclick= "this.style.background=this.style.background=='img/2.gif'?'img/1.gif':'img/2.gif'"> </td>
</tr>
</table>