PROBLEM WITH JAVA ?

+1 Jasmina Savic · September 11, 2014
Hello friends,


I have problem working with Java Script..When I open Google I get blank page ? Functions with Java Script File not working....I don t know why ?


Here is the route (example):



HTML:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="en">
<head>
    <script src="bucky.js"></script>
</head>
<body>
    <section id="main">
       <canvas id="canvas" width="600" height="400">
        I hope this will work.
       </canvas>   
   </section>   
</body>
</html>



Java Script file:



function doFirst(){
   var x = document.getElementById('canvas');
   canvas = x.getContext('2d')
   var g = canvas.createLinearGradient(0,0,100,100);
   g.addColorStop(.0,"blue");
   g.addColorStop(.1,"red");   
   canvas.fillStyle=g;
   canvas.fillRect(0,0,100,100);
}
window.addEventListener('Load', doFirst, false);




Post a Reply

Replies

Oldest  Newest  Rating
+3 Franz Schmidt · September 11, 2014
You have to write "load" instead of "Load" in your Eventlistener:

window.addEventListener('load', doFirst, false);
0 Jasmina Savic · September 12, 2014
I'm so careless sometimes :'(:ermm:

Thank you again dear Franz ! :)
  • 1

Javascript

126,683 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators