Reputation: 21
I am very new to coding, I started taking a programming class a month ago and we were recently assigned our first project. I am trying to get my javascript code into my index.html. So far I have this in my html page:
<script src="/project1/prices.js" type='Javascript/text></script>`
My javascript page currently has this in it:
var price1Name = "Tickets for 18 and under";
var price2Name = "Tickets for 18 and over";
var price3Name = "T-shirt (all sizes)";
var price4Name = "Jackets (all sizes)";
var price1price = "$5.00";
var price2price = "$10.00";
var price3price = "$15.00";
var price4price = "$20.00";
document.write(price1Name);
document.write(price1price);
document.write(price2Name);
document.write(price2price);
document.write(price3Name);
document.write(price3price);
document.write(price4Name);
document.write(price4price);
All I am trying to do is input this code into my Html page so that I am able to display the items and their prices. I can't seem to figure out what I am doing wrong. Thanks for your time, anything helps!
Upvotes: 0
Views: 65
Reputation: 21
<!DOCTYPE html>
<html>
<head>
<title>JavaScript</title>
</head>
<body>
<script>
//code
</script>
</body>
</html>
You can paste your JavaScript code between the script tags in the body. This will allow you to insert JavaScript code into your HTML page.
Upvotes: 0
Reputation: 16576
Looks like your script
tag has a couple errors
<script src="/project1/prices.js" type="text/javascript"></script>
Upvotes: 2