Two-dimensional array batch change the product prices in cells, cell product prices
The following describes how to obtain and operate data in cells in batches.
Complete case:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<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>
</Head>
<Body>
<Table class = "table-bordered bor bg_fff">
<Thead>
<Tr class = "bg_00a3cb">
<Th> specification ID </th>
<Th> ERP Code </th>
<Th> manufacturer code </th>
<Th> product specifications </th>
<Th> market price </th>
<Th> ticket price </th>
<Th> No fare </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 = "100"> original price </option>
<Option value = "98"> 9.8 off </option>
<Option value = "95"> 9.5 off </option>
<Option value = "92"> 9.2 off </option>
<Option value = "90"> off </option>
<Option value = "88"> 8.8 off </option>
<Option value = "85"> 8.5 off </option>
<Option value = "80"> off </option>
<Option value = "75"> 7.5 off </option>
<Option value = "70"> </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>
</Html>
Effect