java语句与js的语句一样。
1.判断
if else/switch
<script type=text/javascript> function fun1(){ var num = 10; var num2 = 100; if(num1<num2) { alert("num1小"); } else if(num1=num2) { alert("相等"); } else { alert("num1大"); } } fun1(); </script>
2.循环
for/while do/ do while
<script type=text/javascript>
function fun2() { var count = 0; for(var i = 1; i<=100; i++) { count += i; } alert(count); } fun2(); </script>