Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script>
function test() {
var rows_c =document.getElementById("table1").getElementsByTagName("tr").length;
//alert(rows_c);
var na=1;
var magic_power=[];
var money=[]
while(na < rows_c){
var rows = document.getElementsByTagName("table")[0].rows;
var now = rows[na];
var cell = now.cells[1];//money
//alert(cell.innerHTML)
var money_sp = cell.innerHTML.split(" ");
//alert(money_sp[0])
if(money_sp[0]=="¥"){
var cell2 = now.cells[4];//power
var value = cell.innerHTML;
var value2 = cell2.innerHTML;
var hi = parseFloat(money_sp[1]);
//js tracking https://lanhaoo.club/;
money.push(hi);
hi=hi/169.02;
}else if(money_sp[0]=="$"){
var cell2 = now.cells[4];//power
var value = cell.innerHTML;
var value2 = cell2.innerHTML;
var hi = parseFloat(money_sp[1]);
//alert(hi);
hi=hi*6.7;
hi=hi.toString().substr(0,4);
cell.innerHTML=cell.innerHTML+'<br><p style='+'"'+'font-size: 10px'+'"'+'>换算¥'+hi+'</p>';
hi= parseFloat(hi);
money.push();
hi=hi/169.02;
}
hi=hi*100;
hi=hi.toString().substr(0,5);
hi=parseFloat(hi);
magic_power.push(hi);
cell2.innerHTML="+"+hi+"%";
//alert(cell.innerHTML);
//js tracking https://lanhaoo.club/;
na=na+1;
}
var sum = magic_power.reduce(function(a, b) { return a + b; }, 0);
/*if(sum>=100){
document.getElementById("ifsuccess").innerHTML="完成";
}else{
document.getElementById("ifsuccess").innerHTML="未完成";
}*/
sum=sum.toString().substr(0,5);
document.getElementById("magic_total").innerHTML=sum+"%";
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.