Login
Search
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,
Reply
 
Thread Tools Display Modes
  #1  
Old 05-15-2008, 08:56 PM
yooksan22 yooksan22 is offline
Junior Member
 
Join Date: May 2008
Posts: 1
Default

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>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-15-2008, 11:21 PM
Peter K Peter K is offline
Junior Member
 
Join Date: May 2008
Posts: 21
Default

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>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Do they even know at Yahoo how to write a Javascript, let alone solve... Virginia Gibson, MD JavaScript 0 05-06-2008 10:31 PM
How to make xml files work on CD presentation? traveller407 XML & XUL 1 05-06-2008 08:38 PM
How to make work the ActiveWire Inc USB board v1.1 under Linux? Isra Linux 0 05-06-2008 04:31 PM
Windows vista video formats to make them work on E Macs? preguntonontrack Windows Vista 1 05-06-2008 12:28 PM
i've did everything to make java work!!!? KEYSHA<3 Java, Java Servlets & JSP 0 05-06-2008 10:00 AM

Your Ad Here

All times are GMT. The time now is 12:49 PM.