日期:2014-05-16  浏览次数:20434 次

表格明细赋值问题
<html>
<head>
<title>my pages</title>
<script type="text/javascript" language="JavaScript">
var indexNumber = "01";
var clothePrice = new Array(4); 
clothePrice[0] = 0;
clothePrice[1] = 1;
clothePrice[2] = 2;
clothePrice[3] = 3;
clothePrice[4] = 4;
clothePrice[5] = 5;
clothePrice[6] = 6;
clothePrice[7] = 7;

function onTypeChange(clothetype) {
var index = clothetype.selectedIndex;
var text = clothePrice[index];
document.getElementById("cost_Price").value = text;
if(document.getElementById("sold_Price").value != "") {
onGetPrice();
}
}

function onGetPrice() {
var sold_price = document.getElementById("sold_Price").value;
var cost_Price = document.getElementById("cost_Price").value;
document.getElementById("get_Price").value = sold_price - cost_Price;
}

function addaction(){
document.getElementById("net").value = 1000;
}
</script>
</head>
<body>
<div>
<table class="button">
<tr>
<td>
<button type = "button">Click me!</button>
</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td align="center">
Date
</td>
<td align="center">
Number
</td>
<td align="center">
Style
</td>
<td align="center">
Cost
</td>
<td align="center">
SoldPrice
</td>
<td align="center">
Profit
</td>
</tr>
<tr>
<td>
<input type="text" name="sold_Date" id="sold_Date" />
</td>
<td align="right">
<label for="">01</label>
</td>
<td width="100px">
<select type="select" name="type" id="type" onchange="onTypeChange(this);">
<option value="0">type</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
<option value="4">D</option>
<option value="5">E</option>
<option value="6">F</option>
<option value="7">G</option>
</select>
</td>
<td align="right">
<input type="text" name="cost_Price" id="cost_Price" readonly="true"/>
</td>
<td align="right">
<input type="text" name="sold_Price" id="sold_Price" onchange="onGetPrice();"/>
</td>
<td align="right">
<input type="text" name="get_Price" id="get_Price" />
</td>
</tr>
<tr>
<td colspan="7">
</td>
<td align="right">
<button type = "button" onclick="addaction()">NET</button>
</