javascript 对象 telecom
1
function google_maps()
{
var latlng;
var myOptions;
var map;
var init = function()
{
set_center(31.2, 121.4);
};
this.change_center = function() //this为公有变量 作接口用
{
set_center(33, 121.4);
};
var set_center = function(jd, wd)
{
latlng = new google.maps.LatLng(jd, wd);
app_option();
};
var app_option = function()
{
myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
app_to_map()
};
var app_to_map = function()
{
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
};
init();
}
var maps = new google_maps();
maps.change_center(); //只有该方法可以访问
2