亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

JavaScript cursor focus event (onfocus)

Cursor focus event (onfocus)


When the object in the web page obtains the focus point, the program that executes the onfocus call will be executed.

The following code, when the cursor is moved into the text box, that is, the focus is in the text box, the onfocus event is triggered and the function fun() is called.

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>php.cn</title>
        <script>
            function fun(){
                window.alert("請輸入真實(shí)姓名")
            } 
        </script>
    </head>
    <body>
        <form>
            姓名:
            <input name="username" type="text" value="請輸入姓名" onfocus="fun()" >
        </form>
    </body>
</html>


Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script> function fun(){ window.alert("請輸入真實(shí)姓名") } </script> </head> <body> <form> 姓名: <input name="username" type="text" value="請輸入姓名" onfocus="fun()" > </form> </body> </html>
submitReset Code