关于Javascript onClick="Javascript:tablestyle(-1);关键就是如何保存上次的值.实际上-1应该用一个变量表示,可这步不知道如何写了.请帮帮忙了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script>function aa(){var a=window.document.table1.a.backgroundColor=rgb:#ffffff }function bb(){var a=window.document.table1.a.backgroundColor=rgb:#000000 }}</script><table id="table1"><tr><td id=a>aaaaaaaaaaa</td></tr></table><img src="hei.jpg" onclick=aa()><img src="hong.jpg" onclick=bb()> 呵呵,我搞定了.<script>var index;index=0;function index1(){ document.all.table1[index].style.backgroundColor=""; index--; tablestyle();}function index2(){ document.all.table1[index].style.backgroundColor=""; index++; tablestyle();}function tablestyle(){ var indexcount=document.all.table1.length-1; if(index<0) { index=indexcount; } if(index>indexcount) { index=0; } document.all.table1[index].style.backgroundColor="#eee7F7"; }</script></head><body><a href="javascript:getwindow('cxzl.asp',150,200);">asdfasdf</a><table width="100%" border="0"> <tr> <td colspan="2"><table width="100%" border="1" cellspacing="0"> <tr id="table1"> <td> </td> </tr> <tr id="table1"> <td> </td> </tr> <tr id="table1"> <td> </td> </tr> <tr id="table1"> <td> </td> </tr> <tr id="table1"> <td> </td> </tr> <tr id="table1"> <td> </td> </tr> </table></td> </tr> <tr> <td><P id="index1" onClick="Javascript:index1();" style="cursor:hand">上一条</a></td> <td><P id="index2" onClick="Javascript:index2();" style="cursor:hand">下一条</a></td> </tr></table> <html><head><script>var curRow=null; //全局行号function selectRow(tr1){ if(curRow) curRow.bgColor="#FFFFFF"; tr1.bgColor="#eee7F7"; curRow=tr1;}function preRow(){ var tbRows=table1.rows; if(curRow){ var curRowIndex=curRow.rowIndex; if(curRowIndex==0) tbRows[tbRows.length-1].click(); else tbRows[curRowIndex-1].click(); }else tbRows[0].click(); //#eee7F7}function nextRow(){ var tbRows=table1.rows; if(curRow){ var curRowIndex=curRow.rowIndex; if(curRowIndex==tbRows.length-1) tbRows[0].click(); else tbRows[curRowIndex+1].click(); }else tbRows[0].click();}</script></head><body><table width="100%" border="0"> <tr> <td colspan="2"> <table id="table1" width="100%" border="1" cellspacing="0" style="border-collapse:collapse " bordercolor="#333333"> <tr onClick="selectRow(this)"><td> </td></tr> <tr onClick="selectRow(this)"><td> </td></tr> <tr onClick="selectRow(this)"><td> </td></tr> <tr onClick="selectRow(this)"><td> </td></tr> <tr onClick="selectRow(this)"><td> </td></tr> <tr onClick="selectRow(this)"><td> </td></tr> </table> </td> </tr> <tr> <td align="right"><a style="cursor:hand " onClick="preRow()"><font color="blue">上一条</font></a></td> <td><a onClick="nextRow()" style="cursor:hand "><font color="blue">下一条</font></a></td> </tr></table></html> IE6下 jQuery+ajax+thickbox 出现的问题。【求解决】 求一个树形菜单的代码 一个很简单的Javascript问题(在线等) 求高手帮我看看这个书签代码的JavaScript调用,先谢为敬! 求对输入值是否为数值的检查方法,是用正则式吧? 一个树型结构,返回时,图片变成小点,要点击一下小点才变成图片,代码如下(分不够再给) 白送分啦,简单的问题,关于滚动条! 如何使当用户设置IE为大字体时,网页里的字体仍保持不变? 我怎样才能用JS控制表格的颜色 窗口关掉问题! 急救,javascript如何释放obeject 滑动杆代替输入数字,如何实现?
function aa(){
var a=window.document.table1.a.backgroundColor=rgb:#ffffff
}
function bb(){
var a=window.document.table1.a.backgroundColor=rgb:#000000
}
}
</script>
<table id="table1">
<tr>
<td id=a>aaaaaaaaaaa</td>
</tr>
</table>
<img src="hei.jpg" onclick=aa()>
<img src="hong.jpg" onclick=bb()>
<script>
var index;
index=0;
function index1()
{
document.all.table1[index].style.backgroundColor="";
index--;
tablestyle();
}
function index2()
{
document.all.table1[index].style.backgroundColor="";
index++;
tablestyle();
}
function tablestyle()
{
var indexcount=document.all.table1.length-1;
if(index<0)
{
index=indexcount;
}
if(index>indexcount)
{
index=0;
}
document.all.table1[index].style.backgroundColor="#eee7F7";
}
</script>
</head><body>
<a href="javascript:getwindow('cxzl.asp',150,200);">asdfasdf</a>
<table width="100%" border="0">
<tr>
<td colspan="2"><table width="100%" border="1" cellspacing="0">
<tr id="table1">
<td> </td>
</tr>
<tr id="table1">
<td> </td>
</tr>
<tr id="table1">
<td> </td>
</tr>
<tr id="table1">
<td> </td>
</tr>
<tr id="table1">
<td> </td>
</tr>
<tr id="table1">
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td><P id="index1" onClick="Javascript:index1();" style="cursor:hand">上一条</a></td>
<td><P id="index2" onClick="Javascript:index2();" style="cursor:hand">下一条</a></td>
</tr>
</table>
<head>
<script>
var curRow=null; //全局行号
function selectRow(tr1){
if(curRow)
curRow.bgColor="#FFFFFF";
tr1.bgColor="#eee7F7";
curRow=tr1;
}function preRow(){
var tbRows=table1.rows;
if(curRow){
var curRowIndex=curRow.rowIndex;
if(curRowIndex==0) tbRows[tbRows.length-1].click();
else tbRows[curRowIndex-1].click();
}else
tbRows[0].click();
//#eee7F7
}
function nextRow(){
var tbRows=table1.rows;
if(curRow){
var curRowIndex=curRow.rowIndex;
if(curRowIndex==tbRows.length-1) tbRows[0].click();
else tbRows[curRowIndex+1].click();
}else
tbRows[0].click();
}
</script>
</head>
<body>
<table width="100%" border="0">
<tr>
<td colspan="2">
<table id="table1" width="100%" border="1" cellspacing="0" style="border-collapse:collapse " bordercolor="#333333">
<tr onClick="selectRow(this)"><td> </td></tr>
<tr onClick="selectRow(this)"><td> </td></tr>
<tr onClick="selectRow(this)"><td> </td></tr>
<tr onClick="selectRow(this)"><td> </td></tr>
<tr onClick="selectRow(this)"><td> </td></tr>
<tr onClick="selectRow(this)"><td> </td></tr>
</table>
</td>
</tr>
<tr>
<td align="right"><a style="cursor:hand " onClick="preRow()"><font color="blue">上一条</font></a></td>
<td><a onClick="nextRow()" style="cursor:hand "><font color="blue">下一条</font></a></td>
</tr>
</table>
</html>