function centent_if() {
var x
= 12;
if(x
>18){
alert("恭喜你,你成年了");
}else{
alert("很抱歉,你还是个胖娃娃...");
}
}
function content_for(){
for(var i
=0;i
<=12;i
++){
alert(i
);
}
}
function table_test() {
document
.getElementById("table_test").innerHTML
= "" +
"<table>" +
" <tr style='background-color: aqua'>" +
" <td> </td> " +
" <td> </td> " +
" <td> </td> " +
" </tr>" +
" <tr style='background-color: antiquewhite'>" +
" <td> </td> " +
" <td> </td> " +
" <td> </td> " +
" </tr>" +
" <tr style='background-color: blueviolet'>" +
" <td> </td> " +
" <td> </td> " +
" <td> </td> " +
" </tr>" +
"</table>";
}
function content_switch() {
var x
= 12;
switch (x
) {
case 10:
alert("x="+x
);
break;
case 12:
alert('x:'+x
);
break;
default:
alert('None');
break;
}
}
function content_while() {
while (true){
window
.console
.log("aaaaa");
window
.console
.log("aaaaa");
window
.console
.log("aaaaa");
break;
}
}
鉴于js比较容易入门,就不再作演示了
转载请注明原文地址:https://ipadbbs.8miu.com/read-51227.html