// 弹出错误信息,并使出错的控件获得焦点
function error(element, message) ...{
alert(message);
if (typeof element == "string") ...{
element = get(element);
}
if (element.focus != null) ...{
element.focus();
}
}
// 对document.getElementById()的包装吧
function get(id) ...{
return document.getElementById(id);
}
// 子窗口关闭的时候,对父窗口进行刷新
function reloadOpener(window) ...{
if (window.opener) ...{
if (window.focus) ...{
window.opener.focus();
}
window.opener.location.reload();
window.close();
}
}
本文提供了几个JavaScript实用函数,包括弹出错误信息并使出错控件获得焦点的功能、对document.getElementById()的封装,以及子窗口关闭时对父窗口进行刷新的方法。

被折叠的 条评论
为什么被折叠?



