脚本未在IE 8中加载

时间:2012-10-30 19:13:46

标签: javascript internet-explorer

我有以下内容在Chrome / Safari / Firefox中正常加载,但无法在IE 8中启动。任何关于错误的想法?

function loadScript() {

var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?sensor=false&' +
    'callback=initialize';
document.body.appendChild(script);
}

window.onload = loadScript;

1 个答案:

答案 0 :(得分:0)

function loadScript() {

var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?sensor=false&' +
    'callback="initialize"'; // added quotes around "initialize"
document.body.appendChild(script);
}

window.onload = loadScript;