欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

JS新手必看:了解1.6版本中的各种事件(如onclick、onchange等)

最编程 2024-02-03 11:07:25
...
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <script language="javascript"> function hello_girl() { alert("小姐,你好!"); } function fun1(str) { alert("你好,"+str); } </script> </head> <body> <h3>MENU:onclick 单击事件</h3> <input type="button" value="问候先生" name="hello1" onclick="alert('先生,你好!')" /> <input type="button" value="问候女士" name="hello1" onclick="hello_girl()" /> <hr /> 有参数 <input type="button" value="先生" name="hello1" onclick="fun1('先生')" /> <input type="button" value="女士" name="hello1" onclick="fun1(this.value)" /> <hr /> <input type="button" value="女士" name="hello1" onclick="javascript:alert('你好吗?')" /> <input type="button" value="你吃饭了吗" name="hello1" onclick="javascript:return confirm('你确认吃饱了?')" /> </body> </html>