【HTML+CSS+JavaScript】九九乗算表

16414 ワード

需要:九九乗法表
DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>     title>
    <style>
        body {
            color: #333;
        }
        table {
            width: 900px;
            table-layout: fixed;
            /*border-collapse: collapse;*/
            empty-cells: hide;
        }
        td {
            border: 1px solid #ccc;
            padding: 10px;
        }
    style>
head>
<body>
    <h1>     h1>
    <hr>


    <script>
        //JavaScript       
        document.write('');

        //     tr  for (var i =1; i <=9; i ++) {
            document.write('');

            //   td    for (var j =1; j <= i; j ++) {
                document.write(`<td>${i}&times;${j} = ${i * j}</td>`);            }
            
            document.write('');
        }

        document.write('
'); document.write('


'); document.write(''); // tr for (var i =9; i >=1; i --) { document.write(''); // td for (var j =1; j <= i; j ++) { document.write(`<td>${i}&times;${j} = ${i * j}</td>`); } document.write(''); } document.write('
'); document.write('


'); document.write(''); // tr for (var i =1; i <=9; i ++) { document.write(''); // for (var m =1; m <= (9-i); m ++) { document.write(''); } document.write('
'); } // td for (var j = 1; j <= i; j ++) { document.write(`<td>${i}&times;${j} = ${i * j}</td>`); } document.write('
'); document.write('


'); document.write(''); // tr for (var i =9; i >=1; i --) { document.write(''); // for (var m =1; m <= (9-i); m ++) { document.write(''); } document.write('
'); } // td for (var j = 1; j <= i; j ++) { document.write(`<td>${i}&times;${j} = ${i * j}</td>`); } document.write('
'); script> body> html>
 
転載先:https://www.cnblogs.com/neymargoal/p/9470986.html