I want to integrate a link with an onclick event to a function like <a href="#" onclick="fireMarker(1);">Map Marker URL 1</a>
and <a href="#" onclick="fireMarker(2);">Map Marker URL 2</a>
into a jump menu like
<select id="selectbox" name="" onchange="javascript:location.href = this.value;">
<option value="https://www.yahoo.com/" selected>Option1</option>
<option value="https://www.google.co.in/">Option2</option>
<option value="https://www.gmail.com/">Option3</option>
</select>
OR
<select onchange="fireMarker(this);">
<option value="15">1</option>
<option value="16">2</option>
<option value="18">3</option>
</select>
The fireMarker function is:
function fireMarker(id){
google.maps.event.trigger(markers[id], 'click');
markers[id].setAnimation(google.maps.Animation.DROP);
markers[id].setVisible(true);
}
When I click an option I want it to execute urls in the format Map Marker URL. I hope to have multiple jump menus on same page Thanks
Replace onchange="fireMarker(this); with onchange="fireMarker(value)"
like:
<html>
<head>
<script type="text/javascript">
function fireMarker(id) {
google.maps.event.trigger(markers[id], 'click');
markers[id].setAnimation(google.maps.Animation.DROP);
markers[id].setVisible(true);
}
</script>
</head>
<body>
<select onchange="fireMarker(value)">
<option value="15">1</option>
<option value="16">2</option>
<option value="18">3</option>
</select>
</body>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.