现在的位置: 首页 > 综合 > 正文

将光标定位于某个元素之上

2013年10月02日 ⁄ 综合 ⁄ 共 451字 ⁄ 字号 评论关闭

<html>
    <head>
        <title>Select Text Example</title>
        <script type="text/javascript">
            function selectText() {
                var oTextbox1 = document.getElementById("txt1");
                oTextbox1.focus();
                oTextbox1.select();
            }
        </script>
    </head>
    <body>
        <input type="text" size="12" id="txt1" value="initial value" /><br />
        <input type="button" value="Select Text" onclick="selectText()" />
    </body>
</html>

【上篇】
【下篇】

抱歉!评论已关闭.