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("您剛剛修改了個(gè)人簡介") } </script> </head> <body> <form> 個(gè)性介紹:<br/><textarea name=" introduction" cols="30" rows="4" onchange="fun()">小明: PHP高級工程師 全棧工程師</textarea> </form> </body> </html>