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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:30:52+00:00 2026-06-13T12:30:52+00:00

I have a function draw_integer(n,s,x,y,plotx) , which draws a integer ,n on HTML5 canvas

  • 0

I have a function draw_integer(n,s,x,y,plotx) , which draws a integer ,n on HTML5 canvas of size s in the coordinates (x,y), I am calling this function inside another function draw_num() as follows,
(plot0, number and size are the respective id’s of canvas, number & size input fields,
function drawnum() is being triggered with an onclick event.)

function drawnum() {
    var n = document.getElementById('number').value;
    var s = document.getElementById('size').value;
    console.debug(n,s);
    draw_integer(n,s,100,100,plot0);   // this  doesn't get executed
    }   

function draw_integer(n,s,x,y,plotx){ //lots of code }

The draw_integer function being called under drawnum doesnt get executed, what is the problem I am unable to identify.

using console.debug() returns the appropriate values of number and size as entered by user, also if i use draw_integer(3,100,100,100,plot0) (draw number 3 of size 100) instead of draw_integer(n,s,100,100,plot0) it works .

So that means that there is some error occuring while passing the varaible n and s from drawnum() to draw_integer().

Thinking that this might be due to to the local scope of the variables , I tried this.

var n = document.getElementById('number').value;
var s = document.getElementById('size').value;

function drawnum() {
console.debug(n,s);
draw_integer(n,s,100,100,plot0);   // this  doesn't get executed
}   

function draw_integer(n,s,x,y,plotx){ //lots of code }

But that didn’t work either.

can you help me out or suggest a better way to solve this problem .

  • 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-13T12:30:53+00:00Added an answer on June 13, 2026 at 12:30 pm
    var n = document.getElementById('number').value;
    var s = document.getElementById('size').value;
    

    The variables n and s above are Strings and not Numbers. You need to either use parseFloat or parseInt to convert it.

    var n = parseInt(document.getElementById('number').value, 10);
    var s = parseInt(document.getElementById('size').value, 10);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object: function Shape(color, position, coordinates){ this.color = color; this.position = position;
Is there an OpenCV function to draw an image over another image? I have
I have function like this: function ypg_delete_img($id, $img) { $q = $this->ypg_get_one($id); $imgs =
I have function some_func_1 which will create an object of type some_type and will
I have this JavaScript function to create a table with image cells: function Draw(array)
I have the following function that draws some data from a chi-squared distribution and
I have a seat function which takes a number of values, 3 of which
I want to save my canvas into MySQL database (BLOB cell). I have function
I have a canvas to which I drawimage() to be a background. I have
I have this formula in a function below. It's a fairly simple concept, yet

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.