如何使用onblur进行多项检查

时间:2012-01-17 16:42:48

标签: javascript html

我有两个完全不同的功能,但使用1个字段输入来检查验证。

我如何使用onblur同时从现场检查这两个功能?

Range of sales in the neighborhood is 
$ <input tabindex="36" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSales1" name="PS_FORM/MARKET_DATA/NeighborhoodSales1" value="{{PS_FORM/MARKET_DATA/NeighborhoodSales1}}" />
to 
$ <input tabindex="37" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSales2" name="PS_FORM/MARKET_DATA/NeighborhoodSales2" value="{{PS_FORM/MARKET_DATA/NeighborhoodSales2}}" /> 
Total # of Properties <input tabindex="38" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSalesNum" name="PS_FORM/MARKET_DATA/NeighborhoodSalesNum" value="{{PS_FORM/MARKET_DATA/NeighborhoodSalesNum}}" onblur="fill_duplicate(this, document.getElementById('PS_FORM/MARKET_DATA/Number_Comps'))" />

我想用thsi函数检查

function get_adjusted_value( sale_price, adjustment, adjusted_value, x) {  

提前致谢

1 个答案:

答案 0 :(得分:2)

定义一个调用两者的函数:

function MyValidation(){
    ValidateFunc1();
    ValidateFunc2();
}

然后将其附加到onblur:

<input onblur="MyValidation();" />

或通过后期绑定:

document.getElementById("MycontrolId").onblur = MyValidation;