依睛(IT blog) 我回来了,PHP<-->C/C++ LINUX

笨鸟

统计

积分与排名

友情连接

最新评论

输入提示 ajax +javascript

在网上找了这么半天, 才找到这个, 不然都不会写,

终于找到了.........


<html>
<head>
<script>
var b=new Array();
b[0]=new Array("a","a1,a3,a4,a5,a6,a7,a8,a9");
b[1]=new Array("b","b1,b3,b4,b5,b6,b7,b8,b9");
b[2]=new Array("c","c1,c3,c4,c5,c6,c7,c8,c9");
b[3]=new Array("d","d1,d3,d4,d5,d6,d7,d8,d9");
b[4]=new Array("e","e1,e3,e4,e5,e6,e7,e8,e9");
b[5]=new Array("f","f1,f3,f4,f5,f6,f7,f8,f9");
b[6]=new Array("g","g1,g3,g4,g5,g6,g7,g8,g9");
b[7]=new Array("k","k1,k3,k4,k5,k6,k7,k8,k9");
b[8]=new Array("l","l1,l3,d4,d5,d6,d7,d8,d9");
b[9]=new Array("e","e1,e3,e4,e5,e6,e7,e8,e9");

function $(id)
{
        return document.getElementById(id);
}

function show(obj)
{
        var x=$("test").offsetTop;
        var y=$("test").offsetLeft;
        $(obj).style.top=x+20;
        $(obj).style.left=y;
        $(obj).style.display="";
                      setTimeout("fclose('showlist')",1000);
}

function fclose(obj)
{
        $(obj).style.display="none";
}

function show_list(obj,obj1)
{
    var str="";
    for(i=0;i<b.length;i++)
    {
        var c=$(obj).value;
        var c1=b[i];
        if(c.indexOf(c1[0])!=-1)
        {
            var d=c1[1].split(",");
            for (j=0;j<d.length ; j++)
            {
                    str+="<div style=\"background-color:#eee;border-bottom:1px solid #ccc;font-size:9pt;width:60px;\" onmouseover=\"this.style.background='#fff';\" onMouseOut=\"this.style.background='#eee';\" onclick=\"$('test').value='"+d[j]+"';fclose('showlist')\">"+d[j]+"</div>"
            }
            $(obj1).innerHTML=str;
            show(obj1);
        }
    }
}
</script>
<body>
<center>
输入字节: <input type="text" size="10" onPropertyChange="show_list('test','showlist')" id="test">
</center>
<br>
<div id="showlist" style="position:absolute; border:1px solid #ccc;display:none">
</div>
</body>
</html>

posted on 2008-12-08 16:36 向左向右走 阅读(151) 评论(0)  编辑 收藏 引用 所属分类: C/C++学习资料库

只有注册用户登录后才能发表评论。