onDeactive方法是用于,在一个窗体失效的时候触发的事件(将鼠标移到控件1时,该控件1被激活,而另一控件2则呈现未激活状态,--控件2则触发事件)
在该方法中调用:
function processDeactivate(item){
switch(item.id){
case "txtProductCode2":
if(trim(txtProductCode2.value) != ""){
var proxyArg = "MT=7" + "&productCode=" + txtProductCode2.value;
var rVal = processProxy(0, "poMain81Proxy.jsp?", proxyArg);
if (rVal == null){
txtProductCode2.value = "";
txtProductCode2.focus();
}else{
var window_element = window.event.toElement;
processClick(window_element);
}
}
break;
}
}
window.event.toElement.id是获取id
window.event.toElement.tagName; 是获取标签名
该段代码的作用就是在文本框未失去焦点的时候,点击按钮一次就能进入另外一个页面
--- 就是在文本框失效的时候就触发button的onclick事件
(注意:文本框和按钮两个控件;文本框失效时,就触发鼠标移动到的另一个控件--按钮的click事件)
window.event.srcElement 当前的对象
http://221.199.150.103/jsj/Html/page/book/js/e_fromElement.htm