Welcome to the iTechForums.
If this is your first visit, be sure to check out the
FAQ by clicking the link above.
You may have to
register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
|
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 2
Members:
Number of Users Online:
Welcome to our newest member, |
|
 |

05-15-2008, 08:56 PM
|
|
Junior Member
|
|
Join Date: May 2008
Posts: 1
|
|
I am new javascript can someone solve this for me, i can make this work?
<HTML>
<HEAD>
<TITLE>TMA 02 Q4(iii)</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE = "JavaScript">
var currentPrice;
var bidIncrement;
var newPrice;
var bidPrice1;
var bidPrice2;
var bidPrice3;
currentPrice = window.prompt('Please enter the current bid price', '');
currentPrice = parseFloat(currentPrice);
bidPrice1 = currentPrice+'.10';
bidPrice2 = currentPrice+'.50';
bidPrice3 = currentPrice+1;
newPrice = currentPrice+10;
if (currentPrice < 10);
{
document.write('The new bid is £ '+bidPrice1);
}
else
{if(currentPrice==10 || currentPrice<100)]
{
document.write ('The new bid is £ ' +bidPrice2);
}
else
{if(currentPrice==100 || currentPrice<1000);
{
document.write ('The new bid is £ ' +bidPrice3);
}
else
{
document.write ('The new bid is £ ' +newPrice);
}
</script>
</body>
</html>
|

05-15-2008, 11:21 PM
|
|
Junior Member
|
|
Join Date: May 2008
Posts: 21
|
|
Hmm, TMA? Sounds like an Open University assignment! I suggest that you work in Firefox and use Tools->Error Console to track Javascript errors. I also suggest that you use Notepad++ to do the editing because that will highlight unmatched braces.
<!DOCTYPE
HTML
PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>TMA 02 Q4(iii)</TITLE>
</HEAD>
<BODY>
<script type="text/javascript">
var currentPrice;
var bidIncrement;
var newPrice;
var bidPrice1;
var bidPrice2;
var bidPrice3;
currentPrice = window.prompt('Please enter the current bid price', '');
currentPrice = parseFloat(currentPrice);
bidPrice1 = currentPrice+'.10';
bidPrice2 = currentPrice+'.50';
bidPrice3 = currentPrice+1;
newPrice = currentPrice+10;
if (currentPrice < 10)
{
document.write('The new bid is £ '+bidPrice1);
}
else
{if(currentPrice==10 || currentPrice<100)
{
document.write ('The new bid is £ ' +bidPrice2);
}
else
{if(currentPrice==100 || currentPrice<1000)
{
document.write ('The new bid is £ ' +bidPrice3);
}
else
{
document.write ('The new bid is £ ' +newPrice);
}
}
}
</script>
</body>
</html>
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
All times are GMT. The time now is 12:49 PM.