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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:16:49+00:00 2026-05-23T03:16:49+00:00

I tried the following code but firefox4 does not display me anything.. <script type=text/javascript>

  • 0

I tried the following code but firefox4 does not display me anything..

<script type="text/javascript">

var canvas = document.getElementById('canvas1');

var context = canvas.getContext('2d');
context.strokeStyle = '#990000';
context.strokeRect(20,30,100,50);
alert(context);
</script>

 <canvas id="canvas1" width="200px" height="200px">Your browser does not   support canvas </canvas>

This code is inside body tag.

  • 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-05-23T03:16:50+00:00Added an answer on May 23, 2026 at 3:16 am

    you have to understand the order in which the file is executed by the browser.
    Here is the way in which the browser is reading this code:

    <script type="text/javascript">
    
    var canvas = document.getElementById('canvas1');
    
    var context = canvas.getContext('2d');
    context.strokeStyle = '#990000';
    context.strokeRect(20,30,100,50);
    alert(context);
    </script>
    
     <canvas id="canvas1" width="200px" height="200px">Your browser does not   support canvas </canvas>
    
    1. Body tag begins
    2. Script tag begins
    3. Find element with ID canvas1
    4. Canvas1 Does not exist, save canvas as null(i take as nothing)
    5. Context = nothing.getContext('2d');
    6. alert(nothing)
    7. End Script
    8. Begin Canvas, since supported dont show what is inside
    9. end body tag

    So to make it visible you just have to edit your code like this:-

    <!DOCTYPE HTML>
    <html>
    <head>
     <title>Sample by RHNVRM(aka rohan verma)</title>
    </head>
    <body>
    <!--Canvas-->
     <canvas id="canvas1" width="200px" height="200px">Your browser does not   support canvas </canvas>
    <!--Begin Script-->
    <script>
    
    var canvas = document.getElementById('canvas1');
    
    var context = canvas.getContext('2d');
    context.strokeStyle = '#990000';
    context.strokeRect(20,30,100,50);
    alert(context);
    </script>
    </body>
    </html>
    

    NOTE: When using Javascript there is no need to mention it in HTML5.

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

Sidebar

Related Questions

server: apache http server 2.2 problem: code does not load my text file hello
I tried the following code on gcc 4.4.5. If the member 'data' is not
Tried to use the following code, but it doesn't work properly: // download the
I tried the following code in LINQPad and got the results given below: List<string>
I tried the following code to get an alert upon closing a browser window:
I have following Code Block Which I tried to optimize in the Optimized section
I've tried the following, but I was unsuccessful: ALTER TABLE person ALTER COLUMN dob
Silly question, but I'm unable to figure out.. I tried the following in Ruby:
I'm going mad with the following problem which does not happen on any other
I have the following code <input type=radio name=HotelSearch_Measure value=Miles> <input type=radio name=HotelSearch_Measure value=KM> However

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.