It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Java Forum

Help with uni assignment pls got six errors to find

Help with uni assignment pls got six errors to find

Postby tiggz1980 on Fri Mar 02, 2007 12:55 pm

Hi there could someone please take a look at the following code and point me in the right direction of where the errors are have found the obvious ones your help would be greatly appreciated.

Thanks

Desperate Student!!!!

<html>
<head> M 150 TMAO3 Question 1
<title>Enter a currency</title>
<script language="JavaScript" >

var currencyType
currencyType = 0;
var amountEntered;
amountEntered = 0;
var amountConverted;
amountConverted = 0;
currencyType = window.prompt('Please enter the currency 0) Dollar 1) Euro,'');
currencyType = parseFloat(currencyType);
while (currencyType >= 0 && currencyType < 2)
{
currencyType = window.prompt('Please re-enter - currency should be 0 or 1', '');
currencyType = parseFloat(currencyType);
}
amountEntered = window.prompt('Please enter the amount to be converted','');
amountEntered = parseFloat(amountEntered);
document.write('<BR>' + amountEntered + ' of type ' + currencyType + ' is ...')

</script>

</head>

<body>
</body>

</html>
tiggz1980
 
Posts: 5
Joined: Fri Mar 02, 2007 12:50 pm
Location: Sheffield, UK

Postby mwa103 on Fri Mar 02, 2007 3:02 pm

Since it is an assignment, I will not be too specific, but you have an improperly terminated string in your code. Once that is fixed, you will be able to find your second problem fairly easily.

As a side note, one thing I would do is download firefox & the firebug addon. Firebug will show you errors in your javascript and makes finding and correcting them a lot easier. The way mine is set up, there is a small icon in the bottom right corner of my screen. If the javascript runs without error it shows a green checkmark. If an error occurs, it shows a red X that when clicked will give you exact error messages with line numbers. It's a handy little tool to have.

-Mike
mwa103
100+ Club
 
Posts: 206
Joined: Mon Mar 07, 2005 10:55 pm


Who is online

Users browsing this forum: No registered users and 1 guest