日期:2014-05-16 浏览次数:20416 次
<script type="text/javascript">
var s = '118.532016,31.758281
------解决方案--------------------
118.522853,31.758066
------解决方案--------------------
118.515559,31.764329
------解决方案--------------------
118.8255715,31.8690843
------解决方案--------------------
118.515092,31.755855
------解决方案--------------------
118.532411,31.755763
------解决方案--------------------
';
s = s.split('
------解决方案--------------------
');
for( var i = 0, len = s.length; i < len; i++ ){
if( s[i].length ){
document.write( 'new BMap.Point('+ s[i] +');' )
document.write( '<br>' )
}
}
</script>
var str = '118.532016,31.758281
------解决方案--------------------
118.522853,31.758066
------解决方案--------------------
118.515559,31.764329
------解决方案--------------------
118.8255715,31.8690843
------解决方案--------------------
118.515092,31.755855
------解决方案--------------------
118.532411,31.755763
------解决方案--------------------
';
str= str.split('
------解决方案--------------------
');
str.pop();/*弹出最后一个空的*/
var temp;
for(var i = 0 ; i < str.length ; ++i){
temp = str[i].split(',');
new BMap.Point(temp[0],temp[1]);
}