• javascript调试测试,利用vs2008:智能对象类型感知,方法及属性提示;立即窗口调试等


    <!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>
        
    <title>测试vs2008对js脚本的支持能力</title>
        
    <script type="text/jscript">
        
    //订购产品总价每500元的倍数打折5%,最低85折扣;每500元的倍数会员等级+1
            function calculate()
            {
                
    var price = document.getElementById("txtPrice").value;
                
    var count = document.getElementById("txtCount").value;
                
    var result = document.getElementById("txtResult").value;
                
    var spanStar = document.getElementById("spanStar");
                
    var result = price * count;
                
    var rr = parseInt( result / 500) ;
                
    var star=0;
                
    switch(rr)
                {
                    
    case 0:
                    
    case 1:
                    
    case 2:
                    
    case 3:
                        result 
    *=(1-rr*0.05);
                        star 
    = rr;
                        
    break;
                    
    default:
                        result  
    *= 0.8;
                        star 
    = 4;
                        
    break;
                }
                
    //vs2008的智能感知知道spanStar是个span空间,我们可以利用其立即窗口调试
                spanStar.innerHTML = "您是" + star + "星级会员,谢谢惠顾!";
                txtResult.value 
    = result;
            }
        
    </script>
    </head>
    <body>
    产品价格:
    <input id="txtPrice" type="text" /><br />
    订购数量:
    <input id="txtCount" type="text" /><br />
    交付金额:
    <input id="txtResult" type="text" readonly="readonly" /><br />
    <span id="spanStar"></span>
    <input id="btnCalc" type="button" value="计算" onclick="calculate()" />
    </body>
    </html>
  • 相关阅读:
    053-242
    053-227
    053-671
    053-489
    053-670
    sql
    白纸黑字签字画押,出人命的事
    CSS
    JS
    Eclipse发布地址不同引发的问题
  • 原文地址:https://www.cnblogs.com/flaaash/p/992878.html
Copyright © 2020-2023  润新知