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

  • SEARCH
  • Home
  • 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 9171803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:12:46+00:00 2026-06-17T16:12:46+00:00

I want to call the variable from the script to body. Here is my

  • 0

I want to call the variable from the script to body.
Here is my script code. I want to take the rightanswers and wronganswers values to use in html body.

GetFeedback = function (a) {
    if (a == CorrectAnswer) {
        rightanswers++;
    } else {
        wronganswers++;
    }
    lock = true;
}
  • 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-17T16:12:47+00:00Added an answer on June 17, 2026 at 4:12 pm

    You need to use the Document Object Modle. You have different methods with JavaScript to create and insert elements into the DOM. As for example:

    var element = document.createElement('p');
    var body = document.body;
    body.appendChild(element);
    

    With that code you are creating an element, then appendig it into the body. And that is pure JavaScript. You could use Mootools or jQuery, and It is goign to be simpler. But JavaScript doesn’t work like PHP for example, where you can use the variables mixed up with the HTML.

    And if you want to trigger the function from the HTML you need to bind thtat function to an event. For example clicking on a link would be.

    HTML

    <a href="#" id="button"> Click Here </a>
    

    JS

    var b = document.getElementById('button');
    b.click = function(){
       GetFeedback();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got some code to pass in a variable into a script from
I want to call external application from shell script, but this shell script gets
I want to call the following code from my pages, and sometimes pass a
I want to call and template and save the output to a variable. I
I want to call a html page on click of a button in mvc.
I want to call a method say success(message) of javascript from android activity. I
I am passing some variable from my gwt code to the jsp file. It
I've got a Perl script that I want to invoke from a Python script.
I want to initialize a Javascript variable from some JSON (generated via Jackson) in
I have a Python script that I want to use as a controller to

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.