Two-dimensional array batch change the product prices in cells, cell product prices

Source: Internet
Author: User

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


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.