contxt()加不加function的区别??
如果在contxt()不加function,则会直接弹出alert警告框了, 如果加了function则不会,必须是点击了onlick后才有会弹框!
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>函数调用</title> <script type="text/javascript"> contxt() //定义函数 { alert("哈哈,调用函数了!"); } </script> </head> <body> <form> <input type="button" value="点击我" onclick=" contxt() " /> </form> </body> </html>