按钮javascript下的div

时间:2012-03-26 21:49:29

标签: javascript html

我想在按钮下面显示一个名为“laila”的隐藏div 这是我的代码:

    <html>
    Disable dates before:<input type="text"><input style="width:20;height:25" type="button" value="myButton" onclick="show()">
    <script>
    function show(){
    document.getElementById("laila").style.display="block"; 
    }
    </script>
    <div id ="laila" style="display: none"><table border="1"><tr><td>laila</td></tr></table></div>

    </html>

如何将div放在“myButton”下?

1 个答案:

答案 0 :(得分:0)

<script>
        function show() {
            document.getElementById("laila").style.display = "block";
        }
    </script>
    <div>
        <table>
            <tr>
                <td>
                    Disable dates before:
                </td>
                <td>
                    <input type="text"><input style="width: 20; height: 25" type="button"   value="myButton"
                        onclick="show()">
                </td>
            </tr>
            <tr id="laila" style="display: none">
                <td>
                </td>
                <td>
                    laila
                </td>
            </tr>
        </table>
    </div>