comrade
May 15, 2003, 05:26 AM
Hey all,
I am having trouble with some easy JavaScript. I'm trying to get ahead on a lab I have tomorrow. If you are familar with JavaScript, the assignment probably seems really easy: (http://www.cs.ucf.edu/courses/cop2500/assignments/cop2500lab02.html)
I am not really concerned with if the code is doing what it is supposed to. That is something for me to learn (plus my code isn't really finished). What I want to know is why I can't see it in a web browser. I can see my html, but nothing from the JavaScript. Any insight would be appreciated. The code will now follow.
P.S.
I was using Camino to preview the html file off my hard drive, if that matters. Thanks to all in advance!
<html>
<head>
<title>
COP2500 Assignment 2
</title>
</head>
<body>
<b><center>Far2Cent()</center></b>
<p>
<script language="JavaScript">
var far1 = 32;
var far2 = 78;
var far3 = 212;
var cent1 = + 5 * (far1 - 32) / 9;
var cent2 = + 5 * (far2 - 32) / 9;
var cent3 = + 5 * (far3 - 32) / 9;
document.write(+ far1 "degrees F = " cent1 "degress C <br>");
document.write(+ far2 "degrees F = " cent2 "degress C <br>");
document.write(+ far3 "degrees F = " cent3 "degress C <br>");
</script>
<p>
<b><center>PriceCalc()</center></b>
<p>
<script language="JavaScript">
var subtotal = 57.24;
var taxrate = 0.06;
var salestax = subtotal * taxrate;
var total = subtotal + salestax;
document.write("Salestax at" taxrate "for a subtotal of" subtotal "is:" salestax);
var salestax = Math.round(salestax * 100);
document.write(salestax "<br>");
var salestax = salestax/100;
document.write(salestax "<br>");
document.write(total);
</script>
</body>
</html>
I am having trouble with some easy JavaScript. I'm trying to get ahead on a lab I have tomorrow. If you are familar with JavaScript, the assignment probably seems really easy: (http://www.cs.ucf.edu/courses/cop2500/assignments/cop2500lab02.html)
I am not really concerned with if the code is doing what it is supposed to. That is something for me to learn (plus my code isn't really finished). What I want to know is why I can't see it in a web browser. I can see my html, but nothing from the JavaScript. Any insight would be appreciated. The code will now follow.
P.S.
I was using Camino to preview the html file off my hard drive, if that matters. Thanks to all in advance!
<html>
<head>
<title>
COP2500 Assignment 2
</title>
</head>
<body>
<b><center>Far2Cent()</center></b>
<p>
<script language="JavaScript">
var far1 = 32;
var far2 = 78;
var far3 = 212;
var cent1 = + 5 * (far1 - 32) / 9;
var cent2 = + 5 * (far2 - 32) / 9;
var cent3 = + 5 * (far3 - 32) / 9;
document.write(+ far1 "degrees F = " cent1 "degress C <br>");
document.write(+ far2 "degrees F = " cent2 "degress C <br>");
document.write(+ far3 "degrees F = " cent3 "degress C <br>");
</script>
<p>
<b><center>PriceCalc()</center></b>
<p>
<script language="JavaScript">
var subtotal = 57.24;
var taxrate = 0.06;
var salestax = subtotal * taxrate;
var total = subtotal + salestax;
document.write("Salestax at" taxrate "for a subtotal of" subtotal "is:" salestax);
var salestax = Math.round(salestax * 100);
document.write(salestax "<br>");
var salestax = salestax/100;
document.write(salestax "<br>");
document.write(total);
</script>
</body>
</html>
