SoFunction
Updated on 2025-02-28

Dynamically add js event implementation code

//Form object
function GetObject(Name)
{
var inputlist=('input');
var i=0;
for(i=0;i<;i++)
{
var input=inputlist[i];
if((Name) !=-1)
{
return input;
}
}
return null;
}
//Set object events
function setEvent(Object,EventName,EventFunction)
{
if(Object ==null)
return;
if()
{
//Event codes for other browsers: Mozilla, Netscape, Firefox
//The order of added events is the execution order //Note that you use addEventListener to add events with on, without adding on
(('on',''), EventFunction, false);
}
else
{
//IE event code Add add method on the original event
(EventName,EventFunction);
}
}
//Lost focus function
function blur()
{
var size= * 0.3;
=ForDight(size,0);
}
// Rounding function
function ForDight(Dight,How)
{
var Dight = (Dight*(10,How))/(10,How);
return Dight;
}
//implement
var lSize=GetObject('STNumberTextBox1');
var pSize=GetObject('STNumberTextBox2');
setEvent(lSize,'onblur',blur);