samples/dashboard/calc.html

(开头部分) 11KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。


<SCRIPT>

//flags to mark previous function
var opFlag_WPQ_=false;        //indicates previous entry was an operator
var eqFlag_WPQ_=false;        //indicates previous function was a calculation


function checkDec_WPQ_() {
//prevents multiple decimal points in entry
        if (document.calc_WPQ_.screen.value.indexOf('.') == -1){
                enterVal_WPQ_('.');
                return;
        }

                if ((document.calc_WPQ_.screen.value.indexOf('.') >= 0) && ((eqFlag_WPQ_) || (opFlag_WPQ_))){
                enterVal_WPQ_('.');
                return;
        }
        
}

function enterVal_WPQ_(num){         
//determine how to handle entry based on previous function
                
        if (eqFlag_WPQ_) {
        //last entry gave a total, no operators entered, so replace both stores
                document.calc_WPQ_.input.value=num;
                document.calc_WPQ_.screen.value=num;
                eqFlag_WPQ_=false;
                return;
        }
        
        if ((!opFlag_WPQ_) && (!eqFlag_WPQ_)){
        //no operators or totals entered, still entering numbers
                document.calc_WPQ_.input.value += num;
                document.calc_WPQ_.screen.value += num;
                return;
        }

        if (opFlag_WPQ_) {
        //operator entered, change screen value, build on input
                document.calc_WPQ_.screen.value =num;
                document.calc_WPQ_.input.value += num;
                opFlag_WPQ_=false;
                return;
        }       

}

function compute_WPQ_() {
//if last entry is an operator, input is not complete so do nothing

        len=document.calc_WPQ_.input.value.length;
        var oneChar=document.calc_WPQ_.input.value.charAt(len-1);
        if ((oneChar == '+') || (oneChar == '-') || (oneChar == '*') ||
                (oneChar == '/')) {     
                return;
        }

后面还有 256 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。