Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 来自html表的google地图数组_Jquery_Arrays_Google Maps - Fatal编程技术网

Jquery 来自html表的google地图数组

Jquery 来自html表的google地图数组,jquery,arrays,google-maps,Jquery,Arrays,Google Maps,我必须从html表中创建变量“stops”。 变量stops具有以下格式: (示例) 该变量用于使用google map创建路径的标记 function setMarkers(map , stops ) { for (var i = 0; i < stops.length ; i + + ) { var beach = stops [i] ; myLatLng var = new google.maps.LatLng (beach [1] , beach [2] )

我必须从html表中创建变量“stops”。 变量stops具有以下格式: (示例)

该变量用于使用google map创建路径的标记

   function setMarkers(map , stops ) {
   for (var i = 0; i < stops.length ; i + + ) {
   var beach = stops [i] ;
   myLatLng var = new google.maps.LatLng (beach [1] , beach [2] ) ;
   var marker = new google.maps.Marker ({
        position: myLatLng ,
        map : map ,
        title : beach [0],
        zIndex : beach [ 3]
        html : beach [4]
    });
arrayOfThisRow必须将变量传递给变量“stops”的函数

var stops = arrayOfThisRow

我希望我是清楚的

我通过在生成谷歌标记的函数中构建数组来解决了这个问题,现在我遇到了另一种问题,但不是新的请求。

var=beach stops[I]这很可能是打字错误?这个
TableData var=$(这个)怎么样。查找('td')?这是:
setMarkers函数(map,stops){
?是的,有一些拼写错误,它们现在是正确的。我的脚本是正确的,但不起作用,谢谢你的报道。
<table id="lista">
<thead> <tr> <th > ID </ th > <th > lat </ th > <th> Log </ th > <th > name </ th > <th > sentence </ th > </ tr>
</ thead >
<tbody >
<tr id="1"> <td class="name"> gussago </ td> <td class="lat"> 45.593741 </ td> <td class="log"> 10.156832 </ td > < td class = " id "> 1 </ td> <td class="frase"> this is gussago </ td > </ tr>
<tr id="2"> <td class="name"> Roncadelle </ td> <td class="lat"> 45.530403 </ td> <td class="log"> 10.15101 </ td > < td class = " id "> 2 </ td> <td class="frase"> this is Roncadelle </ td > </ tr>
...
<tr style="visibility:hidden;"> <td> < / td > <td> </ td> <td> < / td > <td> </ td> <td> < / td > </ tr>
</ tbody >
</ table>
$ ("#lista tbody ").each(function () {
$ (this).find('tr').each(function () {
index + + ;
arrayOfThisRow [index ] = [];
TableData var = $ (this). find ( ' td ' ) ;
if ( TableData.length > 0) {
tableData.each (function ( ) {
if ($ (this). hasClass ('name ' )) { var name = " ' " + $ (this). text () + " ' " ; arrayOfThisRow [ index]. push ( name );}
if ($ (this). hasClass ( ' lat ' )) { var lat = $ (this). text () ; arrayOfThisRow [ index]. push ( lat );}
if ($ (this). hasClass ( ' log ' )) { var log = $ (this) . text () ; arrayOfThisRow [ index]. push ( log) ;}
if ($ (this). hasClass ( ' id ' )) { var index = aindex ; arrayOfThisRow [ index]. push ( aindex );}
if ($ (this). hasClass ( ' sentence ' )) { var sentence = " ' " + $ (this). text () + " ' " ; arrayOfThisRow [ index]. push ( sentence );}
});
}
});
});
arrayOfThisRow.pop ();
var stops = arrayOfThisRow