把div的style position 设置为absolute display属性初始为none
点击的时候把坐标改成同一行里面

解决方案 »

  1.   

    <input value="show" type="button" onClick="show(this)"><br>
    <input value="show" type="button" onClick="show(this)"><br>
    <input value="show" type="button" onClick="show(this)"><br>
    <input value="show" type="button" onClick="show(this)"><br>
    <input value="show" type="button" onClick="show(this)"><br>
    <div id="div" style="height:250px; width:300px; background-color:#00FFFF; position:absolute; display:none"></div>
    <script>
    function show(obj){
    var div=document.getElementById("div")
    div.style.display="block" 
    div.style.left=obj.offsetLeft+obj.offsetWidth+10+"px"
    div.style.top =obj.offsetTop +"px"
    }
    </script>