LiveZilla Live Help
 


Go Back   Chime Host - Web Hosting Forum > World Wide Web > Programming / Scripting / Coding Forum > Javascript
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Javascript Need help with the (primarily) client-side programming language? This is the place. Includes discussion on AJAX (Asynchronous JavaScript and XML).

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-27-2009, 04:09 AM
Junior Member
 
Join Date: Oct 2009
spylogo is on a distinguished road
Default I need help with this html/javascript program?

I can't get it to work... Any ideas? been working on it for hours.

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-Type" content="text/html;charset=utf-8" />
<title> Irish HomeLand Micro-Brewrey Cost Calculator </title>
<script language ="JavaScript"
type="text/javascript">
<!--
var value;
var type;
var quantity;
var name;
var i = 1;
function calculate() {
type = Beverage.selectedIndex;
quantity = Quantity.selectedIndex;
value = i;
name = "I"+ value;
document.form1.(name).value=Beverage.options[i-1].text;
name = "U"+ value;
document.form1.(name).value=Beverage.options[i-1].value;
name = "Q" + value;
document.form1.(name).value=Quantity.selectedIndex ;
name = "P" + value;
document.form1.(name).value=Quantity.selectedIndex *Beverage.options[i-

1].value+5*Quantity.selectedIndex;
i++;
}

//-->
</script>
</head>



<body bgcolor="#63bdb5">

<center><H1>Irish HomeLand Micro-Brewrey Cost Calculator</H1></center>
<Center><font face="Monospace">Order Below</font>
</p></Center>
<p></p>
<center>
Beverage
<SELECT NAME="Beverage">

<OPTION SELECTED VALUE=24.99>Shamrock Ale - Cost: 24.99
<OPTION VALUE=27.99>Lucky Pillsner - Cost 27.99
<OPTION VALUE=24.99>Irish Wheat - Cost 27.99
<Option VALUE=32.99>Irish Malt - Cost 32.99
<Option VALUE=35.99>Shamrock Rye - Cost 35.99
</SELECT>

Quantity

<SELECT NAME="Quantity">

<OPTION>1
<OPTION>2
<OPTION>3
<Option>4
<Option>5
<Option>6
<Option>7
<Option>8
<Option>9
<Option>10
</SELECT>

<INPUT TYPE="button"
VALUE="Add to List"
onClick="calculate();">
</center>
<p></p>
<form name="form1"
id="form1">
<center>
<table border="1">
<tr>
<th> Item Description </th>
<th> Unit Price </th>
<th> Qty </th>
<th> Price(unit x qty+ship) </th>
</tr>
<tr>
<td><INPUT TYPE=text NAME="I1" readonly>
</td>
<td><INPUT TYPE=text NAME="U1" readonly>
</td>
<td><INPUT TYPE=text NAME="Q1" readonly>
</td>
<td><INPUT TYPE=text NAME="P1" readonly>
</td>
</tr>
<tr>
<td><INPUT TYPE=text NAME="I2" readonly>
</td>
<td><INPUT TYPE=text NAME="U2" readonly>
</td>
<td><INPUT TYPE=text NAME="Q2" readonly>
</td>
<td><INPUT TYPE=text NAME="P2" readonly>
</td>
</tr>
<tr>
<td><INPUT TYPE=text NAME="I3" readonly>
</td>
<td><INPUT TYPE=text NAME="U3" readonly>
</td>
<td><INPUT TYPE=text NAME="Q3" readonly>
</td>
<td><INPUT TYPE=text NAME="P3" readonly>
</td>
</tr>
<tr>
<td><INPUT TYPE=text NAME="I4" readonly>
</td>
<td><INPUT TYPE=text NAME="U4" readonly>
</td>
<td><INPUT TYPE=text NAME="Q4" readonly>
</td>
<td><INPUT TYPE=text NAME="P4" readonly>
</td>
</tr>
<tr>
<td><INPUT TYPE=text NAME="I5" readonly>
</td>
<td><INPUT TYPE=text NAME="U5" readonly>
</td>
<td><INPUT TYPE=text NAME="Q5" readonly>
</td>
<td><INPUT TYPE=text NAME="P5" readonly>
</td>
</tr>
<tr>
<td><INPUT TYPE=text NAME="I6" readonly>
</td>
<td><INPUT TYPE=text NAME="U6" readonly>
</td>
<td><INPUT TYPE=text NAME="Q6" readonly>
</td>
<td><INPUT TYPE=text NAME="P6" readonly>
</td>
</tr>
<tr>
<td>Total Price
</td>
<td><INPUT TYPE=text NAME="total" readonly>
</td>
</td>
</tr>
</table>
</center>
</form>
cut off part...

document.form1.(name).value=
Beverage.options[i-1].text;

name = "U"+ value;
document.form1.(name).value=
Beverage.options[i-1].value;
name = "Q" + value;
document.form1.(name).value
=Quantity.selectedIndex;
name = "P" + value;
document.form1.(name).value
=Quantity.selectedIndex*Beverage.options[i-

1].value+5*Quantity.selectedIndex;
i++;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-27-2009, 08:09 AM
Junior Member
 
Join Date: Oct 2009
Blackcompe is on a distinguished road
Default

You can start by deleting that HTML comment at line 9.
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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a basic JavaScript program. I'll give points Thanks? E-Unit923 Javascript 0 10-22-2009 05:15 PM
HTML and JavaScript calculator help? Dylan Javascript 0 10-20-2009 06:10 PM
ADSENSE PROGRAM adsense success program? Manian M SEO - Search Engine Optimization 16 08-30-2009 09:37 AM
Advertising Program naives Web Hosting Support 7 05-29-2007 09:04 AM
Anyone know how to program a PHP script for something? loco-sequencer Programming / Scripting / Coding Forum 3 12-08-2006 04:33 PM


All times are GMT +1. The time now is 10:49 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ChimeHost, a Profuse Solutions LLC company