0
我有一個jQuery的對話框,我從項目列表火在jTemplate:消防使用Javascript/jQuery的jQuery的對話框後,.load
<a href="#" class="view-map" id="{$T.Address.AddressCity.Lat}|{$T.Address.AddressCity.Lon}"><img src="/images/iconography/tiny-map.png" width="16" height="16" alt="See this address on a map..." title="See this address on a map..."></img></a>
的jQuery:
$('.view-map').live('click', function() {
$('#map')
.data('id', $(this).attr('id'))
.dialog('open')
;
return false;
});
$('#map').dialog({
autoOpen: false,
resizeable: false,
position: 'top',
modal: true,
width: 650,
open: function() {
var location = $(this).data('id').split('|');
$(this).load('/components/google/map.aspx?lat=' + location[0] + '&lon=' + location[1]);
},
buttons: {
'Ok': function() {
$(this).dialog('close');
}
}
});
當map.aspx
頁我想要下面的JavaScript來觸發(所以我可以從Google獲得地圖):
function initialize() {
var myOptions = {
zoom: 9,
disableDefaultUI: true,
center: new google.maps.LatLng(<%=Lat%>, <%=Lon%>),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('x-map-placeholder'), myOptions);
document.getElementById('x-map-loader').style.display = 'none';
}
function loadScript() {
alert("I'm away!");
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize';
document.body.appendChild(script);
}
function toLower(s) {
return s.toLowerCase();
}
function toFixed(n) {
return n.toFixed(0);
}
window.onload = loadScript;
顯然,這不,我認爲這是對話框,因爲怎麼叫 - 我知道,調用一個對話框不window.onload
ING,因此不會觸發loadScript
,但我不知道該怎麼做才能得到它火....
誰能幫助? :)
幫助表示讚賞。
真棒!而且超級快。非常感謝:) +1 – dooburt
歡迎:) – Breezer