纯javascript 九九乘法表

来源:互联网 发布:js正则匹配引号 编辑:程序博客网 时间:2024/05/17 02:08

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript">
        function f1()
        {
            for (var i = 1; i < 10; i++)
            {
                for (var j = 1; j<=i;j++)
                {
                        document.write(i + '*' + j + '=' + i * j);
                        document.write("&nbsp;&nbsp");
                }
                document.write("<br/>");
            }
        }
    </script>
</head>
<body>
    <input id="Button1" type="button" value="button" onclick="f1()" />
</body>
</html>

效果图

原创粉丝点击