Hi All,
I am developing the map plugin with the third part map api, but I have a blocking issue about how to include the third part map api,
such as the api address is "http://api.map.baidu.com/api?v=1.3",
I have add the document.write('<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>'); in the javascript file, but it is not work, I am pleasure if you can give me some suggestion, thanks!
the detail code is below:
var krpanoplugin = function()
{
var local = this; // save the 'this' pointer from the current plugin object
var krpano = null; // the krpano and plugin interface objects
var plugin = null;
var plugincanvas = null; // optionally - a canvas object for graphic content
var plugincanvascontext = null;
// registerplugin - startup point for the plugin (required)
// - krpanointerface = krpano interface object
// - pluginpath = string with the krpano path of the plugin (e.g. "plugin[pluginname]")
// - pluginobject = the plugin object itself (the same as: pluginobject = krpano.get(pluginpath) )
local.registerplugin = function(krpanointerface, pluginpath, pluginobject)
{
krpano = krpanointerface;
plugin = pluginobject;
plugin.registercontentsize(256,256);
plugincanvas = document.createElement("div");
plugincanvas.id = "map";
plugincanvas.width = 256;
plugincanvas.height = 256;
plugincanvas.style.width = "100%"; // automatic scale with parent
plugincanvas.style.height = "100%";
document.write('<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>');
var map = new BMap.Map("map");
var point = new BMap.Point(116.404, 39.915);
map.centerAndZoom(point,15);
// the plugin "sprite" variable holds the visible html element
// - it can be used to add elements or events
plugin.sprite.appendChild(plugincanvas);
alert("end register");
}
}