innerHTML with For Loop in Javascript

后端 未结 2 1242
遇见更好的自我
遇见更好的自我 2021-01-03 06:44

this is my coding. in this coding i want to print table in innerHTML in

paragraph tag.This is working but the problem is when i click submit button this result show only

2条回答
  •  别那么骄傲
    2021-01-03 07:12

    When you call demop.innerHTML = something you overwrite it each time. You should either:

    • Put the entire string in a temporary result variable and then give it to innerHTML
    • Concatenate the different results by doing

      demop.innerHTML = demop.innerHTML + (value+"*"+ a +"="+ value*a);

提交回复
热议问题