Google maps 在信息窗口中添加带有onclick事件的按钮

Google maps 在信息窗口中添加带有onclick事件的按钮,google-maps,Google Maps,我试图在google map api v3的信息窗口中添加一个带有onclick事件的按钮 var cont = "<div><h4><b>Transformer</b></h4><label>Name: </label>"+this.transformerName.charAt(0).toUpperCase()+this.transformerName.substring(1)+"<br&

我试图在google map api v3的信息窗口中添加一个带有onclick事件的按钮

        var cont = "<div><h4><b>Transformer</b></h4><label>Name: </label>"+this.transformerName.charAt(0).toUpperCase()+this.transformerName.substring(1)+"<br><label>Site No: </label>"+this.siteNo+"<br><label>Substation No: </label>"+this.substationNo+"<br><label>Transformer No: </label>"+this.unitNo+"<br><button onclick='voltagemodel()'>voltagetrend</button></div>";
    console.log(cont);
    infowindow.setContent(cont);
var cont=“TransformerName:”+this.TransformerName.charAt(0).toUpperCase()+this.TransformerName.substring(1)+“
站点号:“+this.siteNo+”
变电站号:“+this.substationNo+”
变压器号:“+this.unitNo+”
电压趋势”; 控制台日志(续); infowindow.setContent(cont);
但是onclick事件没有启动,请帮助

尝试使用

  <button onclick='voltagemodel();'>voltagetrend</button>
电压趋势
你错过了