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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:43:29+00:00 2026-06-15T16:43:29+00:00

I set the function called drawEverything() to run onload, however the function doesn’t run

  • 0

I set the function called “drawEverything()” to run onload, however the function doesn’t run and I get a bug in Firebug saying “drawEverything is not defined”?? Thing is, I did define it!

I googled the problem and most of the time it was due to some kind of syntax error, but I’ve looked all over it and can’t find any syntax errors.

My code is as follows:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>

<script type="text/javascript">

var new_x = 110;
var new_y = 150;
function drawEverything(){
    var temp_x = new_x;
    var temp_y = new_y;

    var c = document.getElementById("myCanvas");
    var ctx = c.getContext("2d");
    for (int i = 0; i < 5; i++){
        ctx.beginPath();
        ctx.arc(temp_x,temp_y,20,0,2*Math.PI);

        ctx.stroke();
        if ((i < 3) || (i == 4)){
            temp_x += 40;
        }
        else if (i == 3){
            temp_y += 20;
            temp_x -= 60;
        }
    }
}
</script>

<body onload = "drawEverything()">
<h1>Interactive Olympic Rings</h1>
<div id="container">
<canvas id="myCanvas" width="300" height="300"></canvas>
</div>

</body>
</html>

Any help would be appreciated, thanks!

  • 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-15T16:43:30+00:00Added an answer on June 15, 2026 at 4:43 pm

    Deal with your errors in order. Later errors can be a consequence of earlier one.

    First error (as reported by firebug):

    SyntaxError: missing ; after for-loop initializer
    [Break On This Error]   
    
    for (int i = 0; i < 5; i++){
    

    Second error:

    ReferenceError: drawEverything is not defined
    

    Since the function definition has compile time errors in it, it is not defined when you come to run it.

    You want var not int.

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

Sidebar

Related Questions

I have a function called testimonials() that basically cycles through a set of divs,
I know I can use a quasi-random number generation function/variable called Rnd. However, I've
How can I set a function to be called when the length of a
In gdb, is it possible to set a breakpoint on a member function called
The MFC offers a function called DDX_CBIndex to get the Index of the current
In Qt I'm trying to set a QTimer that calls a function called update
I am using jquery slider. I set a function to be on called on
In this function I get xml through a kiss xml function called AFKissXMLRequestOperation. But
If you use set_new_handler and your handler function is called, is errno guaranteed to
Consider this class: class test { public function __set($n, $v) { echo __set() called\n;

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.