Cannot insert line into table

Asked 1 years ago, Updated 1 years ago, 29 views

I am a beginner at javascript.
I'd like to print the table that I just wrote on the head.
I couldn't.Where did you get it wrong?
Could you tell me?
Thank you for your cooperation.

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title> </title>
    <script>
    function print_table(){
        var goods=["chair", "desk", "bookstand";
        var price = [4000,12000,800];
        for(vari=0;i<3;i++){
            document.write("<tr>");
            document.write("<td>"+good[i]+"</td>");
            document.write("<td>"+price[i]+"yen</td>");
            document.write("</tr>");
        }
    }
    </script>
</head>
<body>
    <table border="1">
        <tr><th>Product Name</th><Price>/th><>
        <script>
            print_table();
        </script>
    </table>
</body>

javascript

2022-09-30 21:32

1 Answers

It's solved!It's not good, but goods is more correct.


2022-09-30 21:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.