A two-dimensional array changes the price of a cell in bulk

Source: Internet
Author: User

The following is the bulk fetching of the data inside the cell and manipulating it.

Full case:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title></title>
<script type= "Text/javascript" src= "Jquery-1.9.1.min.js" ></script>
<body>
<table class= "Table table-bordered bor bg_fff" >
<thead>
<tr class= "BG_00A3CB" >
<th> Specifications Id</th>
&LT;TH&GT;ERP Coding </th>
<th> Factory Code </th>
<th> Product Specifications </th>
<th> Market Price </th>
<th> Price including ticket </th>
<th> not open Fares </th>
</tr>
</thead>
<tbody id= "ZKJ" >
<tr>
<td>1</td>
<td>42</td>
<td>21</td>
<td>11</td>
<td>123</td>
<td>234</td>
<td>456</td>
</tr>
<tr>
<td>1</td>
<td>42</td>
<td>21</td>
<td>11</td>
<td>321</td>
<td>432</td>
<td>654</td>
</tr>
</tbody>
</table>
<select name= "Saleprice" class= "inline Input-small" id= "Salepro" onchange= "tt ()" >
<option value= ">" Original Price </option>
<option value= "98" >9.8 folding </option>
<option value= "Up" >9.5 folding </option>
<option value= ">9.2" </option>
<option value= ">9" </option>
<option value= ">8.8" </option>
<option value= ">8.5" </option>
<option value= ">8" </option>
<option value= ">7.5" </option>
<option value= ">7" </option>
</select>
<script type= "Text/javascript" >
var tarray = new Array ();
For (Var x=0;x<$ (' #zkj tr '). length;x++) {
Tarray[x]=new Array ()
for (Var y=4;y<7;y++) {
tarray[x][y]=$ (' #zkj tr:eq (' +x+ ') td:eq (' +y+ ') '). html ();
}
}
function tt () {
var AA = document.getElementById (' Salepro ');
var Price=aa.value;
Price=parseint (Price)
For (Var x=0;x<$ (' #zkj tr '). length;x++) {
for (Var y=4;y<7;y++) {
$ (' #zkj tr:eq (' +x+ ') td:eq (' +y+ ') '). HTML (tarray[x][y]*price/100)
}
}

}
</script>
</body>

Effect


A two-dimensional array changes the price of a cell in bulk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.