JavaScript text...LOGIN

JavaScript text box content change event (onchange)

Text box content change event (onchange)


The onchange event is triggered by changing the content of the text box, and the called program is executed at the same time.

The following code, when the user changes the text in the text box, a dialog box "You have just modified your personal profile" will pop up.

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>php.cn</title>
        <script>
            function fun(){
                window.alert("您刚刚修改了个人简介")
            } 
        </script>
    </head>
    <body>
        <form>
            个性介绍:<br/><textarea name=" introduction" cols="30" rows="4" onchange="fun()">小明:
            PHP高级工程师
            全栈工程师</textarea>
        </form>
    </body>
</html>


Next Section
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script> function fun(){ window.alert("您刚刚修改了个人简介") } </script> </head> <body> <form> 个性介绍:<br/><textarea name=" introduction" cols="30" rows="4" onchange="fun()">小明: PHP高级工程师 全栈工程师</textarea> </form> </body> </html>
submitReset Code
ChapterCourseware