[英]Jump menu with onclick function
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我想将带有 onclick 事件的链接集成到 function 中,例如<a href="#" onclick="fireMarker(1);">Map Marker URL 1</a>
和<a href="#" onclick="fireMarker(2);">Map Marker URL 2</a>
13A8B658D <a href="#" onclick="fireMarker(2);">Map Marker URL 2</a>
进入跳转菜单,如
<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: fireMarker function 是:
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.当我单击一个选项时,我希望它以 Map 标记 URL 格式执行 url。 I hope to have multiple jump menus on same page Thanks我希望在同一页面上有多个跳转菜单谢谢
Replace onchange="fireMarker(this); with onchange="fireMarker(value)"将 onchange="fireMarker(this); 替换为 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.