function max(x,y){
if(x>y){
return x;
}
else if(x<y){
return y;
}
else{
return("两个数相等");
}
}
document.write(" 5 和 4 的较大值是:"+max(5,4)+"<br>");
document.write(" 6 和 3 的较大值是:"+max(6,3)+"<br>");
document.write(" 6 和 3 的较大值是:"+max(6,6));
if(x>y){
return x;
}
else if(x<y){
return y;
}
else{
return("两个数相等");
}
}
document.write(" 5 和 4 的较大值是:"+max(5,4)+"<br>");
document.write(" 6 和 3 的较大值是:"+max(6,3)+"<br>");
document.write(" 6 和 3 的较大值是:"+max(6,6));
document.write("系好安全带,准备起航--目标,诺森德!");
//页面中弹出提示框
alert("为胜利,献身!");
//页面中弹出提示框
alert("为胜利,献身!");
<script type="text/javascript">
document.write("JS进阶篇");
alert("关注JS高级篇");
</script>
document.write("JS进阶篇");
alert("关注JS高级篇");
</script>
2015-07-09
1.创建的新数组是空数组,没有值,如输出,则显示undefined。
2.虽然创建数组时,指定了长度,但实际上数组都是变长的,也就是说即使指定了长度为8,仍然可以将元素存储在规定长度以外。
2.虽然创建数组时,指定了长度,但实际上数组都是变长的,也就是说即使指定了长度为8,仍然可以将元素存储在规定长度以外。
2015-07-08
var numa,numb,jq1,jq2;
numa = 1;
numb = 7;
jq1 = numa > numb;
jq2 = numa != numb;
document.write(numa + "大于" + numb + "的分数吗?" + jq1 + "<br>");
document.write(numa + "不等于" + numb + "的分数吗?" + jq2);
numa = 1;
numb = 7;
jq1 = numa > numb;
jq2 = numa != numb;
document.write(numa + "大于" + numb + "的分数吗?" + jq1 + "<br>");
document.write(numa + "不等于" + numb + "的分数吗?" + jq2);
2015-07-08
操作符之间的优先级(高到低):
算术操作符 → 比较操作符 → 逻辑操作符 → "="赋值符号
算术操作符 → 比较操作符 → 逻辑操作符 → "="赋值符号
2015-07-08