编程语言
首页 > 编程语言> > JavaScript 代码

JavaScript 代码

作者:互联网

以下为引用的内容:

  
    function GetObject(Name)
    {
        var inputlist=document.all.tags('input');
        var i=0;
        for(i=0;i<inputlist.length;i++)
        {
            var input=inputlist[i];
            if(input.id.indexOf(Name) !=-1)
            {
                return input;
            }
        }
        return null;
    }

    function setEvent(Object,EventName,EventFunction)
    {
        if(Object ==null)
            return;
        if(window.addEventListener)
        {
            Mozilla, Netscape, Firefox
            /addEventListener
            Object.addEventListener(EventName.replace('on',''), EventFunction, false);
        }
        else
        {
            Object.attachEvent(EventName,EventFunction);
        }
    }

     
     function blur()
     {
        var size=lSize.value * 0.3;
        pSize.value=ForDight(size,0);
     }


    function ForDight(Dight,How)
    {
     var Dight = Math.round (Dight*Math.pow(10,How))/Math.pow(10,How);
     return Dight;
    }

     var lSize=GetObject('STNumberTextBox1');
     var pSize=GetObject('STNumberTextBox2');
     setEvent(lSize,'onblur',blur);

标签:function,Dight,JavaScript,return,代码,Object,var,input
来源: https://www.cnblogs.com/ymcs/p/15140013.html