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 8791207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:48:41+00:00 2026-06-13T22:48:41+00:00

I have a number of variables in my script that I would like to

  • 0

I have a number of variables in my script that I would like to be able to edit through the HTML side of the program. This way if changes need to be made to the program, the script can be left well alone and changes can be made through the HTML.

Here are the variables I would like to edit in the HTML:

var numberToComplete = 2;
var xAxis = 8;
var yAxis = 6;
var populationAmount = 2; 

Is there any way of doing this, if so how?

  • 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-13T22:48:41+00:00Added an answer on June 13, 2026 at 10:48 pm
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Testing Variable Capturing</title>
            <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
            <script>
            var numberToComplete = 0;
                var xAxis = 0;
                var yAxis = 0;
                var populationAmount = 0; 
    
                function setValues() {
                    numberToComplete = $("#numberToComplete").val();
                    xAxis = $("#xAxis").val();
                    yAxis = $("#yAxis").val();
                    populationAmount = $("#populationAmount").val();
                }
                function getValues() {
                    $("#result").text("numberToComplete: " + numberToComplete + " | xAxis: " + xAxis + " | yAxis: " + yAxis + " | populationAmount: " + populationAmount);
                }
            </script>
        </head>
        <body>
           numberToComplete : <input id="numberToComplete" type="text"/><br/>
           xAxis: <input id="xAxis" type="text"/><br/>
           yAxis: <input id="yAxis" type="text"/><br/>
           populationAmount: <input id="populationAmount" type="text"/><br/>
           <input type="button" onclick="setValues();" value="Set Values" />
           <input type="button" onclick="getValues();" value="Get Values" /><br/>
           <div id="result"></div>
        </body>
    </html>
    

    The above code illustrates a simple form which captures the values typed in by the user and sets the values equal to the variables you want. This example makes use of a jQuery reference.

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

Sidebar

Related Questions

In Actionscript you can have global variables like this: var number : Number =
If I have a class that contains a number of typedef 'd variables, like
I have a NAnt script that compiles our web application, but would like to
I have this while loop, that basically loops through a lot of records in
I'm writing a bash script that spawns a number of background processes. I'd like
I have 100 text files which look like this: File title 4 Realization number
I have a script that sometimes break because I get an error like: PHP
I would like to instanciate a class, that takes any number of consturctor params.
I would like to be able to accomplish the same thing that I do
I have c++ code that has grown exponential. I have a number of variables

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.