1.document.write()可以向页面直接输出语句,把内容输出在页面上。write内可以写html的代码,也可以写基本内容
document.write("")里面是双引号,如果要设置标签的属性,要写为单引号
document.write("")可以输出变量,也可以输出html代码
document.write
2.打印99乘法表
<html>
<head>
<title>html示例</title>
</head>
<body>
<script>
document.write("<table border='1' bordercolor='blue'>")
for(var i=1;i<=9;i++){
document.write("<tr>")
for(var j=1;j<=i;j++){
document.write("<td>");
document.write(i+"*"+j+"="+i*j);
document.write("</td>")
}
document.write("</tr>")
//document.write("<br/>");
}
document.write("</table>")
</script>
</body>
</html>