把你所有按钮都做成键盘热键 AccessKey
解决方案 »
- 学着点写了个小小的JS库,求点评。
- prototype 请求到另一个页面
- 关闭标签页,如何让它不释放ocx控件
- execCommand粘贴问题
- 删除文件时出错??
- 简单!怎样禁止checkbox响应表格行的onclick事件?表格行有一个单击事件,如:<tr onclick="alert('你好')">
- 小妹高分求救!
- 我要在javascript的一个事件中引用另一个事件中定义的变量,怎样定义该变量,使它为全局呢?
- js问题 button 按钮点击一次后 改变条件后无法点击无反应
- 问个用jqplot画柱状图的问题
- 关于JS 控制list翻页保存每页选中的状态--在线请教
- javascript如何得到指定月份的下一个月?
下面是显示的代码
<table width="150" cellpadding=0 cellspacing=0 >
<tr>
<td width="" height="" align="center" valign="top">
<TABLE onmouseover="this.style.backgroundColor='#FF6600'" onmouseout="this.style.backgroundColor=''" width=150 height=150 cellSpacing=1 cellPadding=2 bgColor=#e1e1e1 border=0>
<TR>
<TD width=152 height=150 bgColor=#ffffff align=center valign="top">
<%if rs("bookpic")="" then
response.write "<div align=center><a href=listinfo.asp?id="&rs("bookid")&" ><img src=images/emptybook.gif width=150 height=150 border=0></a></div>"
else%>
<a href=listinfo.asp?id=<%=rs("bookid")%> > <img src="<%=trim(rs("bookpic"))%>" width=150 height=150 border=0 align=absmiddle></a>
<%end if%>
</TD>
</TR>
</TABLE>
</td>
</tr>
<tr>
<td height="" align="center"><img src="images/ring01.gif" width="9" height="9">
<%response.write "<a class=a4 href=listinfo.asp?id="&rs("bookid")&" ><font color=#FF6600>"
if len(trim(rs("bookname")))>12 then
response.write left(trim(rs("bookname")),10)&".."
else
response.write trim(rs("bookname"))
end if
response.write "</font></a>"
%>
<font color="#999999">
<%if len(trim(rs("bookcontent")))>25 then
response.write left(trim(rs("bookcontent")),25)&"..."
else
response.write trim(rs("bookcontent"))
end if%>
</font> <br></td>
</tr>
<tr>
<td height="" align="center">规格:<%=rs("isbn")%><font color="#FF0000"><%=rs("bookchuban")%></font></td>
</tr>
<tr>
<td height="" align="center">价格:<font color="#FF0000"><strong><%=rs("huiyuanjia")%></strong></font><font color="#FF0000"><strong>元</strong></font></td>
</tr>
<tr>
<td height="" align="center"><a href="cart.asp?id=<%=rs("bookid")%>&action=add"><img src="images/shopcart2.gif" width="71" height="21" border=0></a>
</td>
</tr>
</table>下面是我修改的键盘超作的代码,但是怎么才能应用到上面去
<style>
#chaborder td{
width:93px;height:43px;text-align:center
}
#chaborder a{
display:block; width:93px;height:43px;OVERFLOW: hidden; cursor:default;
}
#chaborder a:hover{width:89px;height:40px;border:1px solid #f00}
#chaborder img{border:0}
.ahover{width:89px;height:40px;border:1px solid #f00}
.aout{display:block; width:93px;height:43px;OVERFLOW: hidden; cursor:default; }
body {
background-color: #ffffff;
}
</style>
<script type="text/javascript">
function MoveCursor(obj){
var row = parseInt(obj.id.substring(1,2));
var col = parseInt(obj.id.substring(2,3));
switch(event.keyCode){
case 37:
if(col > 1)
col--;
break;
case 38:
if(row > 1)
row--;
break;
case 39:
if(col < 3)
col++;
break;
case 40:
if(row < 3)
row++;
break;
case 65:
window.location="/shopping/test/gw.asp";
break;
}
obj = document.getElementById("a" + row.toString() + col.toString());
//obj.click();
obj.focus();
obj.className = "ahover";
status = obj.innerText;
}
</script>谢谢各位大大帮忙看下
------
看不明白..... 你意思是使用方向键控制表格中的单元格中连接的选择?设置连接的样式?? 别发有 <%%>的代码,发运行过后生成的html代码
<script>
//使用键盘控制上下页翻滚,你给a加个id就可以,具体代码看我帮你改的导航........
var rowIndex=-1,colIndex=-1,MaxRow=2,MaxCell=3;
var LinkUrl="";
document.onkeydown=function(e)
{
var TempRowIndex=rowIndex,TempColIndex=colIndex;//获取上次的下标
e=e||event;
switch(e.keyCode)
{
case 65://A
var aNext=document.getElementById("aNext");//获取下一页的a标签
if(aNext&&aNext.href) location=aNext.href;
return;
case 66://B
var aPre=document.getElementById("aPre");//获取上一页的a标签
if(aPre&&aPre.href)location=aPre.href;
return;
case 13://Enter
if(LinkUrl!="")location=LinkUrl;
return;//注意是return,停止执行下面的代码
case 37://左
if(rowIndex==-1)//没有选择
{
rowIndex=0;colIndex=0;
}
else
{
if(colIndex>=0) colIndex--;
if(colIndex<0) colIndex=MaxCell-1;
}
break;
case 38://上
if(rowIndex==-1)//没有选择
{
rowIndex=0;colIndex=0;
}
else
{
if(rowIndex>=0)rowIndex--;
if(rowIndex<0)rowIndex=MaxRow-1;
}
break;
case 39://右
if(rowIndex==-1)//没有选择
{
rowIndex=0;colIndex=0;
}
else
{
if(colIndex<MaxCell) colIndex++;
if(colIndex>=MaxCell) colIndex=0;
}
break;
case 40://下
if(rowIndex==-1)//没有选择
{
rowIndex=0;colIndex=0;
}
else
{
if(rowIndex<MaxRow)rowIndex++;
if(rowIndex>=MaxRow)rowIndex=0;
}
break;
}
var FoucsTbs,PreFocusTbs,a;
var tbList=document.getElementById("tbList");
if(TempColIndex!=-1)
{
PreFocusTbs=tbList.rows[TempRowIndex].cells[TempColIndex].getElementsByTagName("table");//获取上次获取焦点的表格
PreFocusTbs[1].style.backgroundColor='';
//清除上次链接的样式
a=PreFocusTbs[0].rows[1].cells[0].getElementsByTagName("a")[0];
a.className="";
}
FoucsTbs=tbList.rows[rowIndex].cells[colIndex].getElementsByTagName("table");//获取当前获取焦点的表格
FoucsTbs[1].style.backgroundColor='#ff6600';
//设置链接获取焦点
a=FoucsTbs[0].rows[1].cells[0].getElementsByTagName("a")[0];
a.className="bold";
LinkUrl=a.href;//获取url,如果按下enter时更改location对象
}
</script>
<style>
a.bold{font-weight:bold;}
</style>
<table width="800" height="500" align="center" valign="top" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<!------给这个talbe加了个id------->
<table width="800" height="" border="0" cellpadding="0" cellspacing="0" id="tbList">
<tr valign="top">
<td width="" height="" align="left" bgcolor="#FFFFFF" valign="top">
<div align="center">
<table width="150" cellpadding=0 cellspacing=0 >
<tr>
<!-----原来的代码--------><TR>
<TD align=right>
<p align=center>
首页
<a href="?page=2" id="aPre">上页</a>
<a href="?page=3" id="aNext">下页 </a>
尾页
页次:1/1页
共有6种商品
</TD>
</TR> </form>
</table>
</td>
</tr>
</table>