关于span标签点击传值的问题~

 body标签已在页面加载的时候有init()方法了,请大神注意
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="jscript">

    var searchService, markers = [];
    var citylocation,map,marker = null;
    var Mrzb;
    function init() {
        //根据用户的浏览器IP定位  得出”经纬度“
        citylocation = new qq.maps.CityService({
                complete : function(result){
                        map.setCenter(result.detail.latLng);
                }
            });
        citylocation.searchLocalCity(); 
        **//怎么样才能把<span></span>标签内的data-lat-code和data-long-code传进来**
        var center = new qq.maps.LatLng(“data-lat-code”,“data-long-code”);  
        var map = new qq.maps.Map(document.getElementById('container'), {
            disableDefaultUI: true,
            panControl: false,
            zoomControl: false,
            scaleControl: false,
            center: center,
            zoom: 13,
            zoomControlOptions: {
                //设置缩放控件的位置为相对左方中间位置对齐.
                // position: qq.maps.ControlPosition.LEFT_CENTER,

            }

        });
    }

    </script>
</head>

<body onLoad="init()">
    <div class="cityb">
        <ul>
        **//点击span标签,传值到上面的js或jq中**
            <li><span data-lat-code="24.919489"  data-long-code="102.478485">安宁</span></li>
            <li><span data-lat-code="36.079834"  data-long-code="114.389412">安阳</span></li>
            <li><span data-lat-code="32.684715"  data-long-code="109.029022">安康</span></li>
            <li><span data-lat-code="26.253071"  data-long-code="105.947594">安顺</span></li>
            <li><span data-lat-code="30.543489"  data-long-code="117.063744">安庆</span></li>
            <li><span data-lat-code="40.299999"  data-long-code="80.400002">阿拉尔</span></li>
            <li><span data-lat-code="41.108639"  data-long-code="122.994324">鞍山</span></li>
            <li><span data-lat-code="22.186834"  data-long-code="113.54303">澳门</span></li>
        </ul>
    </div>
</body>
</html>

查看全部
zhongwei127day
zhongwei127day
2015/08/16 07:06
  • 传值
  • jq
  • js
  • span点击
  • 点赞
  • 收藏
  • 回答
    私信

3个回复