<?xml version = "1.0" encoding = "utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org//TR/xhmtl/DTD/xhtml-strict.dtd">
<!--nochange.html
A document for nochange.js
-->
<html xmins = "http:www.w3.org/1999/xhtml">
<head> <title> nochange.html </title>
<!-- Script for the event handlers-->
<script type = "text/javascript" src = "nochange.js" >
</script>
</head>
<body>
<form action = "">
<h3> Coffee Order Form </h3>
<!-- A bordered table for item orders-->
<table border = "border">
<!--First, the column headings-->
<tr>
<th> Product Name </th>
<th> Price </th>
<th> Quantity </th>
</tr>
<!-- Now, the table order entries-->
<tr>
<th> French Vanilla (1 lb.) </th>
<td> $3.49 </td>
<td> <input type = "text" id = "french"
size = "2" /> </td>
</tr>
<tr>
<th> Hazlenut Cream (1 lb.) </th>
<td> $3.95 </td>
<td> <input type = "text" id = "hazlenut"
size = "2" /> </td>
</tr>
<tr>
<th> Colombian (1 lb.) </th>
<td> $4.59 </td>
<td> <input type = "text" id = "columbian"
size = "2" /></td>
</tr>
</table>
<!-- Button for precomputation of the total cost -->
<p>
<input type = "button" value = "Total Cost"
onlick = "computeCost();" />
<input type = "text" size = "5" id ="cost"
onfocus = "this.blur();"/>
</p>
<!-- The Submit and reset buttons-->
<p>
<input type = "Submit" value = "Submit Order" />
<input type = "reset" value = Clear Order Form" />
</p>
<!-- COST
<p>
<script>
function myFuction()
{
var french = document.getElementById("french").value;
var hazlenut = document.getElementById("hazlenut").value;
var colombian = document.getElementById("colombian").value
document.getElementById("cost").value =
totalCost = french * 3.49 + hazlenut * 3.95 + colombian *4.59;
</script>
</p>
}
</form>
</body>
</html>
Спустя 5 минут, 11 секунд (9.10.2012 - 09:49) Winston написал(а):
Цитата (dilfin @ 9.10.2012 - 09:44) |
<!-- COST |
Комментарий не закрыт.
Цитата (dilfin @ 9.10.2012 - 09:44) |
<p> <script> |
Зачем <script> помещать в <p>?
Что показывает консоль?
Спустя 9 минут, 59 секунд (9.10.2012 - 09:59) dilfin написал(а):
Цитата (Winston @ 9.10.2012 - 06:49) | ||||
Комментарий не закрыт.
Зачем <script> помещать в <p>? Что показывает консоль? |
popravila no eshyo ne rabotaet
<?xml version = "1.0" encoding = "utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org//TR/xhmtl/DTD/xhtml-strict.dtd">
<!--nochange.html
A document for nochange.js
-->
<html xmlns = "http:www.w3.org/1999/xhtml">
<head> <title> nochange.html </title>
<!-- Script for the event handlers-->
<script type = "text/javascript" src = "nochange.js" >
</script>
</head>
<body>
<form action = "">
<h3> Coffee Order Form </h3>
<!-- A bordered table for item orders-->
<table border = "border">
<!--First, the column headings-->
<tr>
<th> Product Name </th>
<th> Price </th>
<th> Quantity </th>
</tr>
<!-- Now, the table order entries-->
<tr>
<th> French Vanilla (1 lb.) </th>
<td> $3.49 </td>
<td> <input type = "text" id = "french"
size = "2" /> </td>
</tr>
<tr>
<th> Hazlenut Cream (1 lb.) </th>
<td> $3.95 </td>
<td> <input type = "text" id = "hazlenut"
size = "2" /> </td>
</tr>
<tr>
<th> Colombian (1 lb.) </th>
<td> $4.59 </td>
<td> <input type = "text" id = "columbian"
size = "2" /></td>
</tr>
</table>
<!-- Button for precomputation of the total cost -->
<p>
<input type = "button" value = "Total Cost"
onclick = "computeCost();" />
<input type = "text" size = "5" id ="cost"
onfocus = "this.blur();" />
</p>
<!-- The Submit and reset buttons-->
<p>
<input type = "Submit" value = "Submit Order" />
<input type = "reset" value = "Clear Order Form" />
</p>
<!-- COST -->
<script>
function computeCost()
{
var french = document.getElementById("french").value;
var hazlenut = document.getElementById("hazlenut").value;
var colombian = document.getElementById("colombian").value;
document.getElementById("cost").value =
totalCost = french * 3.49 + hazlenut * 3.95 + colombian * 4.59;}
</script>
</form>
</body>
</html>
Спустя 4 минуты, 37 секунд (9.10.2012 - 10:03) Winston написал(а):
<!-- COST заменить на <!-- COST -->
onlick = "computeCost();" != onсlick = "computeCost();"
id = "columbian"
getElementById("colombian")
columbian != colombian
onlick = "computeCost();" != onсlick = "computeCost();"
id = "columbian"
getElementById("colombian")
columbian != colombian
Спустя 3 минуты, 24 секунды (9.10.2012 - 10:07) dilfin написал(а):
Цитата (Winston @ 9.10.2012 - 07:03) |
<!-- COST заменить на <!-- COST --> onlick = "computeCost();" != onсlick = "computeCost();" id = "columbian" getElementById("colombian") columbian != colombian |
spasibo brat moy spasibo Vam Ogromnoe!!!!
Спустя 25 минут, 22 секунды (9.10.2012 - 10:32) dilfin написал(а):
Цитата (Winston @ 9.10.2012 - 07:03) |
<!-- COST заменить на <!-- COST --> onlick = "computeCost();" != onсlick = "computeCost();" id = "columbian" getElementById("colombian") columbian != colombian |
а вы можете сказать если мне нужно добавить 5 % налога при выборе продуkта будет
totalCost = (french * 3.49 + hazlenut * 3.95 + colombian *4.59/100)*5;
?