如何添加星级评分系统 [英] How to add star rating system

查看:88
本文介绍了如何添加星级评分系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


到目前为止,我正在使用谷歌地图,我从帮助中获得的是用户可以向地图添加位置。我想要一个星级评分系统,我看了几个在线论坛,但不太明白。以下是我的代码

Hi I am working on google maps so far what i have achieved from help is that a user can add locations to the map. I want to have a star rating system, i ahve looked at few online forums but cannot quite understand it. Below is my code

<!DOCTYPE html>
<html>
  <head>
    <title>Accessing arguments in UI events</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script>
var index=0;
function initialize() {
  var mapOptions = {
    zoom: 4,
    center: new google.maps.LatLng(65.0126304,25.4703071)
  };
  var map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);

  google.maps.event.addListener(map, 'click', function(e) {
    placeMarker(e.latLng, map);
  });
}

function placeMarker(position, map) {
  var marker = new google.maps.Marker({
    position: position,
    map: map
  });
var infowindow = new google.maps.InfoWindow({ content : "<input id='myText" + index + "' type='text'>", id : index
});

  map.panTo(position);
google.maps.event.addListener( marker, "click", function() {
   infowindow.open( map, marker );
});
google.maps.event.addListener( infowindow, "closeclick", function(e) { infowindow.setContent("<input id='myText" + infowindow.id + "' type='text' value='" + document.getElementById("myText" + infowindow.id).value + "'>"); });
index++;
}
google.maps.event.addDomListener(window, 'load', initialize);

index++;
    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>





无论如何,谢谢你们



Thanks anyways guys

推荐答案

这篇关于如何添加星级评分系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆