Javascript file not linking to html

2019-09-14 20:46发布

Hello I finished all of my code but my Javascripts aren't showing to my html but I am sure that I have linked them correctly. Can I have a extra set of eyes to see what I am doing wrong? If you can that would be great because I am not very good at javascript, thanks.

*I have two Java script files in here because I have one for my main javascript and ball*

//ball.js


function ball()
{
//The ball itself
this.startAngle=0;
this.endAngle=360*Math.PI * 2;
this.radius=40;
this.drawBall = true;

//location for my ball
this.x = canvs/width/2;
this.y = canvas/height/2;

//coloring my ball
this.color = " #00FFFF";


//draw function

this.draw = function()
{
context.fillStyle = this.color;
context.beginPath();
content.arc(this. x,this. y, this. redius, this.startAngle, this.Endangle, this.drawBall);
context.fill();
	
}
 
 
 
 }
 
 
 //My main Javascript
 
 //Variables to use
var canvas;
var context;
var ball;

canvas = documnet.getElementById("canvas");
context = canvas.getcotnext("2d");

//Creates my ball function based off of what is on canvas for ball
var = ball = new Ball();

ball draw()
​​<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" >
<title>Robert's Ball Game</title>
<link type="text/css" rel="stylesheet" href = css/robs.css" />
</head>

<body>
<canvas id="canvas" width="1000" height="720"></canvas>



</body>
//Javascript
<script type="text/javascript" src= "javas/ball.js"> </script>
<script type="text/javascript" src= "javas/rob.js"> </script>

</html>

0条回答
登录 后发表回答