JavaScript 学习笔记
程序结构 :JavaScript脚本语言只提供了两种结构:条件结构, 循环结构 If语句: <html > <head> <title>IF语句的使用</title> </head> <body> <script language="javascript"> function rec(form) { var a=form.recshortth.value; { if(a>60) alert("及格"); else alert("不及格"); } } </script> <form> <input type="text" name="recshortth"><br> <input name="button" type="button" onclick="rec(this.form)" value="显示"> </form> </body> </html> For语句: <html> <head> <title>For语句循环</title> </head> <body> <script language="javascript"> var i=1 for(i=1;i<=4;i++) { document.write("<h",i,">欢迎大家一起来学习JavaScript!</h",i,">"); } </script> </body> </html> Do While语法