JSP实现 乘法口诀输出

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script>
for(var i=1;i<=9;i++)
{
    
    for(var k=1;k<=i;k++)
    {
        document.write(k+"x"+i+"="+k*i+"\t"+"&nbsp;")    
    }
    document.write("<br />")    
}
document.write("<br />")
document.write("<br />")
for (var i=1;i<=9;i++)
{
    for (var k=1;k<=i;k++)
    {
        document.write(i+"x"+k+"="+k*i+"\t"+"&nbsp;")
    }
    document.write("<br />")    
}
</script>
<br>
<%
String b=" ";
for(int i=1;i<=9;i++)
{
    for(int k=1;k<=i;k++)
    {
        b+=k+"x"+i+"="+k*i+" ";
    }
    b=b+"<br>";
}

%>
<%=b %>


</body>
</html>

posted @ 2016-10-28 13:32  戳记  阅读(1209)  评论(0编辑  收藏  举报