我必须要变量 xx = 38.929787 yy = 22.675781
如何在javascript中将它们从python传递给GLatLng(lat,long)并且具有lat = xx和long = yy
def pymapjs(self):
""" Returns complete javacript for rendering map """
self.js = """\n<script src=\"http://maps.google.com/maps?file=api&v=2&key=%s\" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
function Point(lat,long,html,icon) {
this.gpoint = new GMarker(new GLatLng(lat,long),icon);
this.html = html;
}
答案 0 :(得分:1)
这样做:
self.js = """\n<script src=\"http://maps.google.com/maps?file=api&v=2&key=%s\" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
function Point(lat,long,html,icon) {
this.gpoint = new GMarker(new GLatLng(%f,%f),icon);
this.html = html;
}""" % (xx, yy)