browser = {
ie: /msie/.test(window.navigator.userAgent.toLowerCase()),
moz: /gecko/.test(window.navigator.userAgent.toLowerCase())
};
function LoadJs(sUrl, fCallback)
{
var _script = document.createElement('script');
_script.setAttribute('type', 'text/javascript');
_script.setAttribute('charset', 'gb2312');
_script.setAttribute('src', sUrl);
document.getElementsByTagName('head')[0].appendChild(_script);
if (browser.ie)
{
_script.onreadystatechange = function()
{
if (this.readyState=='loaded' || this.readyState=='complete')
{
fCallback();
}
};
}
else if (browser.moz)
{
_script.onload = function()
{
fCallback();
};
}
else
{
fCallback();
}
}
posted on 2008-11-03 09:34
汪杰 阅读(273)
评论(0) 编辑 收藏 引用 所属分类:
javascript