Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8723033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:32:18+00:00 2026-06-13T07:32:18+00:00

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

  • 0

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 last value like this “10*10=100” but i want to run full loop which i define in code from 1 till 10. Please solve this issue.

<html>
<head>
<title>Table Program</title>
</head>
<body>
<input type="text" id="table" placeholder="Enter table"/>
<input type="button" value="Submit" onClick="table()"/>
<p id="demo"></p>
<!----------------------------------------------------------------------------------------------->
<script type="text/javascript">
function table()
{
    var value = document.getElementById("table").value;
    var demop = document.getElementById("demo");
    var a;
    for(a=1; a <= 10;++a)
    {
        demop.innerHTML=(value+"*"+ a +"="+ value*a);
    }
    }
</script>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:32:19+00:00Added an answer on June 13, 2026 at 7:32 am

    Your for loop is overwriting the innerHTML of demop each time it is executing.
    So when your for loop reaches last iteration a will be 10 and hence you only get the last value “10*10=100”

    So you should append the result every time you iterate your for loop
    just make it like this

    demop.innerHTML += (value + "*" + a + "=" + (value*a) + "<br />");

    So you will get your output on seperate lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My friend done this below coding for custom control <a href=javascript:__doPostBack('id','msg');>click</a> now i want
This is what i am doing in coding i want to create controls on
I'm trying to use this coding but its not processing, and its not outputing
I am coding this layout as a wordpress theme and having a slight problem
I have been asked this questions before but this time i want to know
this is some basic IF THEN statement stuff but I'm a coding newbie so
GMP allows to print a mpz_t up to base 62, but I want to
Can anyone notice an error in this coding??? NSString *textFilePath = [[NSBundle mainBundle] pathForResource:@test
I have just a question... I'm seeing this coding style in various php scripts
Mine is this: Hard coding is the way! All my problems go away. Just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.