PDA

View Full Version : PLEASE help (Javascript.. new question) need to do it in the next 5 hours :(



Jamesrt2004
01-17-2010, 08:17 AM
Hi there Im trying out some javascript for an assignment but im so stuck right now its not even funny....

right I think if you see wht i've done so far you'll understand what i'm trying to do.... and i think it'll be some stupid mistake.. but im doing it on notepad++ so I cant debug or anything!!

right here is what i got


<HTML>
<HEAD>
<TITLE>help</TITLE>
<SCRIPT LANGUAGE = "JAVASCRIPT">

// A price calculation program for Mermaid Holidays

var initialPrice; // Advertised price of the holiday in pounds
var age; // Age in years of the holidaymaker
var halfPrice;
initialPrice =
window.prompt('Please enter the advertised price of the holiday in pounds', '');
initialPrice = parseFloat(initialPrice);
age =
window.prompt('Please enter age of holidaymaker', '');
age = parseFloat(age);
halfPrice = initialPrice/2;
if (age <= 5}
{
document.write('Your holiday is Free');
}
else
if (age < 15)
{
document.write('Your holdiday is ' + halfPrice + '');
}
else
{
document.write('Your holiday is ' + initialPrice + '');
}
// Insert your code here

</SCRIPT>

</HEAD>
<BODY>
</BODY>
</HTML>


any help is amazing!!!!




ok

sorted

needed to change the

if (age <= 5}
{

to if (age <= 5)
{

silly typo really, then changed the (age < 15 to age <=15

so anyone with simple errors there you go :up:

s1nykuL
01-18-2010, 08:38 AM
I use this to debug Javascript:

http://www.mozilla.org/projects/venkman/

It's an addon for Firefox, it might help in the future.