function __attachEvent(elm, evType, callback, useCapture) { var obj = typeof elm == "string"?document.getElementById(elm):elm; if (obj.addEventListener) { obj.addEventListener(evType, callback, useCapture); return true; } else if (obj.attachEvent) { var r = obj.attachEvent('on' + evType, callback); return r; } else { obj['on' + evType] = callback; } return false; } //页面加载时 __attachEvent(window,"load",pageLoadGetUserMsg,false);