javascript - How to add a action for addDOMListener of Google Maps -


I just want to load Google Maps based on the mouseover event of various div elements. To do this I just used the following simple code. This code itself is not working, someone can tell me what I did wrong.

  & lt; Script type = "text / javascript" & gt; Function initialize () {var mapDiv = document.getElementById ('map-canvas'); Var map = new google.maps.Map (mapDiv, {center: new google.maps.LatLng (40.740, -74.18), zoom: 12, map typewrite: google.maps.MapTypeId.ROADMAP}); Var content = '& lt; Strong> An info window! & Lt; / Strong> & Lt; Br / & gt; This is bound to a marker; Var infowindow = new google.maps.InfoWindow ({content: content}); Var Marker = New google.maps.Marker ({Map: Map, Status: map.getCenter (), Dragable: True}); Infowindow.open (map, marker); } Google.maps.event.addDomListener ($ ("# showmap"), 'mouseover', function () {alert ("hi");}); & Lt; / Script & gt; & Lt; Div id = 'showmap' & gt; Show map & lt; / Div & gt; & Lt; Div id = "map-canvas" style = "width: 500px; height: 400px" & gt; & Lt; / Div & gt;   

Above the Simple Soft Function, this is not said for ordinary code. Can anyone help me find fault?

รข ????

Code>. In addition, "addDomListenerOnce" needs to be started only once.
  $ ("# showmap") [0]   

  google.maps.event.addDomListenerOnce ($ ("# Showmap") [0], 'mouseover', function () {start ();});    

Comments