【发布时间】:2015-07-31 10:09:23
【问题描述】:
我收到以下错误。
错误
语法错误:属性列表后缺少 }
内容:Al futaim, 贸易公司
<br />Saih Shuaib 3 36 号楼 M ——
PHP 代码
$content=$servicecenter->getCompanyName()."<br />".$servicecenter->getAddress()."<br /><button type='button' value='Get Direction' class='button' onclick='closeInfoWindow(),calcRoute()' name='Get Direction'>Get Direction</button>";
脚本
var infowindow = new google.maps.InfoWindow({
content:<?php echo $content; ?>;
});
【问题讨论】:
-
您需要添加引号(双引号或单引号都可以)
-
添加更多信息:您需要添加引号(双引号或单引号都可以),删除 php 结束标记后的分号并记住转义输出(即尝试添加斜杠或 htmlentities )
-
添加引号后出现错误 SyntaxError: unterminated string literal content:
标签: javascript php google-maps