如何使用javascript创建标签?

时间:2015-02-16 10:35:03

标签: javascript php html5

我需要在Google地图标记中创建一个标记。我有以下代码来显示Google地图标记。我需要点击它的标记才能转到另一页。

function bindInfoWindow(marker, map, infoWindow, html) {
      google.maps.event.addListener(marker, 'click', function() {
        infoWindow.setContent(html); 
        infoWindow.open(map, marker);
        document.getElementById('hid_place').value=html;
        document.getElementById("loc_name").value=html;   
        //  $("#serach_fun").show(); 
      });
    }

我该怎么办

1 个答案:

答案 0 :(得分:0)

// Create DOM element with JavaScript
var anchor = document.createElement("a");

// insert new element into the DOM structure (as a child of another element)
marker.appendChild(anchor);

// set element attributes
anchor.innerHTML = "click here";
anchor.src = "http://www.site.ext/page.html";

有关详细信息,请参阅HTML DOM createElement() Method

相关问题