I've recently begun learning HTML and JavaScript and am in the process of creating a simple video rental script in Notepad++. After creating the script, it fails to execute locally in any browser. I am curious as to what parts may have been improperly used or if I am missing something entirely, thank you.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
var name = window.prompt("Hello, what is your name?");
var choice = window.prompt("DVD or Blu-Ray?");
var days = parseInt(window.prompt("How many days are you renting for?"));
if (choice == "DVD") {
double dvdcst = 2.99;
double dvdtot = dvdcst * days;
document.write("Name: " + name "<br />"
"Days renting: " + days + "<br />"
"Cost per day: " + dvdcst + "<br />"
"Total cost: " + dvdtot + "<br />");
} else if (choice == "Blu-Ray") {
double blucst = 3.99;
double blutot = blucst * days;
document.write("Name: " + name + "<br />"
"Days renting: " + days + "<br />"
"Cost per day: " + blucst + "<br />"
"Total cost: " + blutot + "<br />");
}
</script>
</body>
</html>
+at the end of each line to continue the string. So"Days renting: " + days + "<br />"becomes"Days renting: " + days + "<br />" +dvdcst * daysandblucst * daysmay give non money formatted results such as6.1instead of6.10.