Simple homework assignment but I apparently missed something
HTML:
Code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Car</title>
</head>
<body>
<script type="text/javascript" src="obj.js"></script>
</body>
</html>
JS:
Code
function car(make, model) {
this.make=make;
this.model=model;
this.running=false;
this.tire1=25;
this.tire2=25;
this.tire3=25;
this.tire3=25;
function start() {
this.running=true;
}
function stop() {
this.running=false;
}
function checkEngine() {
if (this.running=true) {
document.write("Car is running!");
}
else {
document.write("Car is currently off.");
}
}
function pressure() {
document.write("<h3>Tire pressures: </h3>"this.tire1 + this.tire2 + this.tire3 + this.tire4);
}
function inflate() {
this.tire1=30;
this.tire2=30;
this.tire3=30;
this.tire4=30;
}
function deflate() {
this.tire1-=1;
this.tire2-=1;
this.tire3-=1;
this.tire4-=1;
}
}
var scion=new car("Scion", "xB");
scion.checkEngine();
scion.start();
scion.checkEngine();
scion.stop();
scion.checkEngine();
scion.pressure();
scion.inflate();
scion.pressure();
scion.deflate();
scion.pressure();
Assignment is to make an object, give it properties and methods, then show that they all work on a webpage by utilizing each method
It won't run (the script). I had another small assignment from earlier that was supposed to prompt the user twice and it wouldn't run either.
I get a blank page.
What am I doing wrong?
extra notes:
in the chrome debugger, my .js was never listed as a source? That seems like a red flag
Professor ONLY wants external javascript, no inline
This post was edited by Eep on Sep 15 2013 06:33pm