Find Amount Column in Table (1.11)
try using mootools 1.11 instead of 1.45
by phsiao2000
HTML
<script src="http://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools-yui-compressed.js"></script>
<html>
<head>
<link rel="stylesheet" href="https://s3.amazonaws.com/ultracartsbg/22000/71498/22000-cart-g.css">
<style type="text/css">
body {
margin : 0;
font-family :"Helvetica Neue", Helvetica, Arial, sans-serif;
font-size : 14px;
line-height : 20px;
color : #333333;
background-color : #ffffff;
}
#header-inner {
clear : both;
margin : auto;
height : 180px;
padding-top : 10px;
background : url(http://www.22000-tools.com/images/backgrounds/inner-header-bg.jpg) no-repeat center top;
}
#title-section {
width : 960px;
margin : 0 auto;
}
.page-title {
width : 600px;
float : left;
height : 100px;
margin : 23px 0 0 0;
}
#title-section h1 {
font-size : 48px;
color : #ebebeb;
}
#title-section h1 sub {
font-size : 17px;
color : #ebebeb;
font-style : italic;
line-height : 60px;
}
.title-icon {
float : left;
margin : 0 20px 0 0;
}
img[src$="spacer.gif"] {
height: 0;
}
#ucSingle {
margin-left : auto;
margin-right : auto;
width : 960px;
}
.ucTableHeaderBackground {
background-color : #f9f9f9;
}
#ShipTableLeft {
float : left;
margin : 4px 4px 20px 4px;
padding-left : 30px;
...
JavaScript
var table = $$('#ucViewCartTableId .ucInfoBoxBackground')[0];
//console.log("table:");console.log(table);
var tbody = table.getChildren('tbody')[0];
//console.log("tbody:");console.log(tbody);
//var tableHeaderTDs = $$('#ucViewCartTableId .ucInfoBoxBackground tbody tr.ucTableHeaderBackground');
var tableHeaderTR = tbody.getChildren('tr.ucTableHeaderBackground')[0];
console.log("table header row:"); console.log(tableHeaderTR);
var amountTD = tableHeaderTR.getChildren('td').filter(function(el,i) {
console.log(i); var text = el.getChildren('span')[0].innerHTML;
console.log(text);
return text == 'Amount';
})[0];
console.log('Amount TD:'); console.log(amountTD);
amountTD.setStyles({'text-align': 'right',
'padding-right': '20px'});
//var quantityTD = tableHeaderTR.getChildren('span');
//console.log(quantityTD);
var quantityScripts = table.getElements('script');
console.log('scripts:'); console.log(quantityScripts);
quantityScripts.each(function(el, i) {
var td = el.getParent().getParent().setStyles({'text-align': 'right',
'padding-right': '20px'});
//console.log(td);
});
var subTotalTR = tbody.getChildren('tr').getLast();
console.log('subtotal TR:'); console.log(subTotalTR);
var subTotalScript = subTotalTR.getElements('td script')[0];
console.log('subtotal script:'); console.log(subTotalScript);
var subTotalTD = subTotalScript.getParent().setStyles({'text-align': 'right',
'padding-right': '20px'});
//window.images = $$('img').set('src','');
//window.debug_inputs = $$('input[src^=/]').set('src','');
//window.debug_inputs.each(function(el, i){console.log (el.outerHTML);});
$$('[src^=/]').each(function (el, i) {
//el.removeProperty('src');
//console.log(el.outerHTML);
});
//debugger;
//console.log(images);