代码实例:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>test</title> </head> <body> <script> function AD() { var control=document.forms[0]['test']; var Direction=control.selectionDirection; alert(Direction); } </script> <form> <input type="test" name="test"> <input type="button" value="点击一下" onclick="AD()"> </form> </body> </html>
效果:
2017-09-02 23:56:57