Please can somebody help me please i am to provide a table of values showing conversion from pounds to dollars, I have to have a table howing different values i.e £150. into dollars, £200. to dollars etc. I have treid this but it doesn't work, please could you give me some idea where i am going wrong. :o

thanx for your help
laguna915

Recommended Answers

All 2 Replies

first lets look at your code:

<HTML>
<HEAD>
<TITLE>Currency Converter B</TITLE>
<SCRIPT>
var amountInPounds, amountInDollars, dollarRate;
document.write('Currency Converter Application B' + '<BR>');
dollarRate = 1.78;
amountInPounds = parseFloat(amountInPounds);
window.prompt('Please enter amount in pounds sterling, 10 to 120','');
while (amountInPounds != 10)
{
document.write('Pounds' + 'Dollars' + '<BR><BR>');
dollarRate = dollarRate * amountInPounds;
window.prompt('Please enter amount in pounds sterling, 10 to 120','');
amountInPounds = parseFloat(amountInPounds)
};
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>

well i think part of your problem is that you told the script that while any value other than 10 to do this, yet you want a value between 10 and 120, you need something more like while (ammountinpounds < 10), so that all values below ten are discounted, and somthing like (i dont know the syntax in js) ammountinpounds >120 so that all values too high will be discounted. also, no where do i see any math to do a conversion...so im a bit lost as too what your code is supposed to do.

Does you page have any output at all? If not then try moving the script from the head to inside of the body tags.

[EDIT]BAH! I just realized the origional post is over a month old :([/EDIT]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.