<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8"><title>计算器</title>
<style type="text/css">
input {
border-bottom-width: 5px;
}
</style>
<!-- //+获取的文本框
var text =
btn.previousElementSibling;
//获取数量
var amount=text.value;
//+1 写入框内
text.value=amount*10+1;
var mny=price*amount;
//获取按钮父亲的弟弟
var td3=btn.parentNode.nextElementSibling;
//把金额写入TD3
td3.innerHTML=mny; -->
<script type="text/javascript">
function YI(asd) {
var text = asd.parentNode.parentNode.parentNode.children[0].children[0].children[0];
var amount=text.value;
if(amount==!isNaN){
text.value=amount*10+1;
console.log(amount);
}else{
var a=amount;
//amount=0;
text.value=a+1;
console.log(amount);
}
}
function ER(asd) {
var text = asd.parentNode.parentNode.parentNode.children[0].children[0].children[0];
var amount=text.value;
if(amount==!isNaN){
text.value=amount*10+2;
console.log(amount);
}else{
var a=amount;
amount=0;
text.value=a+2;
console.log(amount);
}
}