<a href="#" onclick='event'><TEXTAREA NAME="" ROWS="" COLS="">context</TEXTAREA></a>

解决方案 »

  1.   

    fanson writed
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta name="Author" content="阿信,fason">
    <meta name="KeyWords" content="下拉框,输入,阿信,fason">
    <title>漂亮下拉框</title>
    <style>
    .selectBox{border:1px solid #993300;height:20px;}
    .editBox{border:0px;width:100px;cursor:default;width:100%;height:19px;padding-top:2px;margin:1px}
    .dropdownbutton{font-size:12px;font-family:webdings;color:#CCFF66;height:20px;background-color:#993300;border:1px solid #993300;padding:0 2;margin:1px;cursor:default}
    .selectContent{position:absolute;border:1px solid #993300;visibility:hidden;z-index:1000;background-color:#FFFFFF}
    .selectContent tr{height:20px;cursor:default}
    .selectContent td{font-size:12px;font-family:Vendana;padding:2 3}
    .OnFocus{color:#FFFFFF;background-color:#993300}
    </style>
    <script language="javascript">
    var CoolSelect=[]
    var CurrentTR=null
    function MouseOver(trObj){
    if(!CurrentTR)CurrentTR=trObj
    CurrentTR.className=""
    trObj.className="OnFocus"
    CurrentTR=trObj;
    }function ButtonOver(BtnObj){
    BtnObj.style.backgroundColor='#cc3300'
    }
    function ButtonOut(BtnObj){
    BtnObj.style.backgroundColor='#993300'
    }
    function MouseClick(Index,trObj){
    with(GetObj(CoolSelect[Index][1])){
    value=trObj.innerText;
    style.backgroundColor='#993300'
    style.color='#FFFFFF'
    focus()
    }
    DropDown(Index)
    }function GoURL(trObj){
    var url=trObj.getAttribute("url")
    if(url&&url!="")window.open(url)
    }function BoxBlur(InputBox){
    with(InputBox.style){backgroundColor="";color=''}
    }function DropDown(Index){
    event.cancelBubble=true
    ContainerReset(Index)
    var show=GetObj(CoolSelect[Index][2]).style.visibility=='visible'
    GetObj(CoolSelect[Index][2]).style.visibility=show?'hidden':'visible'
    setPosition(Index)
    }function document::onclick(){
    for(i=0;i<CoolSelect.length;i++){
    GetObj(CoolSelect[i][2]).style.visibility='hidden'
    with(GetObj(CoolSelect[i][2]))for(j=0;j<rows.length;j++)rows[j].style.display=""
    }
    }function window::onresize(){
    for(i=0;i<CoolSelect.length;i++)setPosition(i)
    }function showTip(Index){
    var inputbox=GetObj(CoolSelect[Index][1])
    var container=GetObj(CoolSelect[Index][2])
    var num=0
    container.style.visibility="visible"
    for(i=0;i<container.rows.length;i++){
    if(container.rows[i].cells[0].innerText.indexOf(inputbox.value)!=0)container.rows[i].style.display="none"
    else {container.rows[i].style.display="";num++}
    }
    if(num==0)container.style.visibility='hidden'
    }function ContainerReset(Index){
    var container=GetObj(CoolSelect[Index][2])
    for(i=0;i<container.rows.length;i++)container.rows[i].style.display=""
    if(CurrentTR)CurrentTR.className=""
    }function setPosition(Index){
    var s=GetObj(CoolSelect[Index][0])
    var container=GetObj(CoolSelect[Index][2])
    var l=s.offsetLeft;
    var t=s.offsetTop;
    while(s=s.offsetParent){l+=s.offsetLeft;t+=s.offsetTop}
    with(container.style){left=l+1;top=t+GetObj(CoolSelect[Index][0]).offsetHeight}
    }function Init(){
    CoolSelect[0]=["ConTainer1","txt1","select1"]
    CoolSelect[1]=["ConTainer2","txt2","select2"]
    for(i=0;i<CoolSelect.length;i++){
    var s=GetObj(CoolSelect[i][0])
    var container=GetObj(CoolSelect[i][2])
    container.style.width=s.offsetWidth>container.offsetWidth?s.offsetWidth:container.offsetWidth
    setPosition(i)
    }
    }
    function GetObj(id){return document.getElementById(id)}
    </script>
    </head><body onload="Init()"><div align="center">
    <table style="width:250;border:2px solid groove;font-size:12px" border=1 cellspacing=0 cellpadding=0>
    <tr bgcolor="green" style="font-weight:bold;color:#FFFFFF">
    <td>输入,提示功能示例</td><td>菜单跳转示例</td>
    </tr>
      <tr>
        <td>
    <table id="Container1" class="selectBox" border="0" width=100 cellspacing=0 cellpadding=0>
      <tr>
        <td>
        <input name="txt1" value=" 请选择 " class="editBox" onblur="BoxBlur(this)" onclick="DropDown(0)" onkeyup="showTip(0)" size="20"></td>
        <td width="1"><span class="dropdownbutton" onmouseover="ButtonOver(this)" onmouseout="ButtonOut(this)" onclick="DropDown(0)">6</span></td>
      </tr>
    </table>
        </td>
        <td>
    <table id="Container2" class="selectBox" border="0" cellspacing=0 cellpadding=0>
      <tr>
        <td>
        <input name="txt2" readOnly=true value=" 请选择 " class="editBox" onblur="BoxBlur(this)" onclick="DropDown(1)" onkeyup="showTip(1)" size="20"></td>
        <td width="1"><span class="dropdownbutton" onmouseover="ButtonOver(this)" onmouseout="ButtonOut(this)" onclick="DropDown(1)">6</span></td>
      </tr>
    </table>
        </td>
      </tr>
    </table>
    </div>
    <table id="select1" class="selectContent" cellspacing=0 cellpadding=0>
      <tr onmouseover="MouseOver(this)" onclick="MouseClick(0,this)" title="作者:Andy">
        <td>一起走过的日子</td>
      </tr>
      <tr onmouseover="MouseOver(this)" onclick="MouseClick(0,this)" title="作者:Andy">
        <td>你是我的温柔</td>
      </tr>
      <tr onmouseover="MouseOver(this)" onclick="MouseClick(0,this)" title="作者:Andy">
        <td>你是我的女人</td>
      </tr>
    </table>
    <table id="select2" class="selectContent" cellspacing=0 cellpadding=0>
      <tr onmouseover="MouseOver(this)" onclick="MouseClick(1,this);GoURL(this)" url="http://expert.csdn.net/expert/forum.asp">
        <td>CSDN论坛</td>
      </tr>
      <tr onmouseover="MouseOver(this)" onclick="MouseClick(1,this);GoURL(this)" url="http://msdn.microsoft.com/library/">
        <td>MSDN参考</td>
      </tr>
      <tr onmouseover="MouseOver(this)" onclick="MouseClick(1,this);GoURL(this)" url="http://www.iecn.net">
        <td>IECN论坛</td>
      </tr>
    </table>
    </body>
    </html>
      

  2.   

    <html>
    <!-- Creation date: 2003-9-26 -->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="author" content="BUCT">
    <meta name="generator" content="AceHTML 5 Pro">
    </head>
    <body>
    <form name="myform">
    <textarea id="text" cols="60" rows="10" onclick ="show()">
    我怕来不及我要抱着你,直到感觉你的绉纹有了岁月的痕迹,直到视线变得模糊直到不能呼吸为了你我愿意动也不能动也要看着你,直到感觉你的发线有了白雪的痕迹,直到肯定你是真的直到失去力气让我们形影不离
    如果全世界我也可以放弃,至少还有你值得我去珍惜而你在这里就是生命的奇迹
    </textarea>
    <select id=list size="4" style="position:absolute;border:1px dotted #000000;display:none" onclick=autofill(this.options[this.selectedIndex].text)>
    <option value="c1">c1</option>
    <option value="c2">c2</option>
    <option value="c3">c3</option>
    <option value="c4">c4</option>
    </select>
    </form></body>
    <script language="javascript">
    var rng=document.all.text.createTextRange();
    function autofill(mytext)
    {
    rng.collapse(false);
    rng.text=mytext;
    hide();
    }
    function hide()
    {
    var o=document.getElementById("list");
    if(o.style.display=="block") o.style.display="none";
    }
    function show()
    {
    var o=document.getElementById("list");
    rng.moveToPoint(event.x,event.y);
    rng.moveStart("character",-document.all.text.value.length);      
    o.style.left=event.x;
    o.style.top=event.y;
    o.style.display="block";
    }
    </script>
    </html>