js 上下键使用
<style type="text/css">
.dropDiv {
position: absolute;
z-index: 10;
display: none;
cursor: hand;
background-color: #eee;
}
.dropDiv .jhover {
background-color: #CCCCCC;
}
.dropDiv .list {
float:left;
width:100%;
}
.dropDiv .word {
float:left;
}
.dropDiv .view {
float:right;
color: gray;
text-align: right;
font-size: 10pt;
}
</style>

<script>
   function over(obj){
      obj.className = "list jhover";
   }
   function down(obj){
      obj.className = "list";
   }
  
  
</script>

<script   language="javascript">
<!--
var   currentLine   =   -1;
document.onkeydown   =   function   (e)    
{
    e   =   window.event   ||   e;
    switch   (e.keyCode)    
    {
        case   38:
            currentLine--;
            changeItem();
            break;
        case   40:
            currentLine++;
            changeItem();
            break;
        default   :
            break;
    }
}
  
//改变选择项目
function   changeItem()
{
    this.$$ = function(o, str){ return o.getElementsByTagName(str);}
    var   it   =   document.getElementById("ice");
var divs = this.$$(it, 'div');
var len = divs.length;
    for   (i=0;i<len;i++)    
    {
        divs.className   =   "list";
    }
    if   (currentLine   <   0)
        currentLine   =   len   -   1;
    if   (currentLine   ==   len)
        currentLine   =   0;
    divs[currentLine].className   =   "list jhover";
}
  
//-->
</script>


<div id="ice" class="dropDiv" style="border: 1px solid rgb(1, 69, 149); left: 911.5px; top: 39px; width: 193px; display: block;">
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="over(this);" onMouseOut="down(this)" ><div class="word">一只苍蝇的激情四射</div></div>
</div>

<script>
    

//alert(xdd);
</script>
lunzi   2010-10-10 20:36:19 评论:1   阅读:1311   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog