Javascript Variable detections

I

Ivann

Hi All,

I have the dilema in the code execution of the submit function. I have
a link on my page that should create only on marker if clicked.
However if the link is clicked more than once and then clicked on the
map it displays the markers amounted to the times it was clicked. Can
anyone assist as to why this is happening with the 2 functions below?


function submit(){

var submitfile;
map.clearOverlays();

document.getElementById("mapwindow").innerHTML = '';
map.getDragObject().setDraggableCursor("crosshair");

var submit = GEvent.addListener(map, "click", function(submitmarkerx,
point) {

if (language=='english'){

submitfile = 'http://www.mysite.com/php/submitplaceform.php'
submitfilex = 'http://www.mysite.com/upload/index.html'
}
else if(language=='espanol'){
submitfile = 'http://www.mysite.com/upload/indexesp.php'
}

var submitmarkerx = createsubmitMarker(point,'<div>Please enter
details for this location on the left side bar and click on save to
add your place</div>');

map.addOverlay(submitmarkerx);

GEvent.addListener(map, "infowindowclose", function(){map.removeOverlay
(submitmarkerx); map.getDragObject().setDraggableCursor("auto");});
GEvent.removeListener(submit);



});
GEvent.addListener(map, "infowindowclose", function(){map.clearOverlays
()



});

}

function createsubmitMarker(point,html) {

var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/
mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

var homemarker = new GMarker(point,{icon:icon, draggable: true});
GEvent.addListener(homemarker, "click", function()
{homemarker.openInfoWindowHtml(html);});
return homemarker;

}
 
T

Thomas 'PointedEars' Lahn

Ivann said:
I have the dilema in the code execution of the submit function. I have
a link on my page that should create only on marker if clicked.
However if the link is clicked more than once and then clicked on the
map it displays the markers amounted to the times it was clicked. Can
anyone assist as to why this is happening with the 2 functions below?

No, because your code is almost unintellegible. Besides, that your function
is named submit() could be a problem. And you should RTFM at Google first.

<http://jibbering.com/faq/#posting>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top