—-java中的语句——
1 判断
if else/ switch
2 循环
for / while do / do while
—-js中的语句—-(语法种类等都与java的一模一样)
1 判断
if else/ switch
2 循环
for / while do / do while
<html>
<head>
<title>js的语句</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function sentence(){
var num1 = 10;
var num2 = 20;
if(num1>num2){
alert("num1大");
}else if(num1<num2){
alert("num2大");
}else{
alert("相等");
}
}
sentence();
-------------------------------------------------
//从1累加到100
function add(){
var count = 0;
for(var i=1;i<=100;i++){
count+=i;
}
alert(count);
}
add();
</script>
</head>
<body>
</body>
</html>