如何通过javascript在我的aspx页面中设置img?

如何通过javascript在我的aspx页面中设置img?,javascript,asp.net,vb.net,image,Javascript,Asp.net,Vb.net,Image,也许这听起来很愚蠢,但我真的不知道如何设置 部分类别: 部分类测试 继承System.Web.UI.Page 受保护的子cmb\u mapa\u Click(ByVal sender作为对象,ByVal e作为System.EventArgs)处理cmb\u mapa。Click Page.ClientScript.RegisterStartupScript(Me.GetType(),“testando”,“testando”(&nr_latitudeTextBox.Text&“,&nr_lo

也许这听起来很愚蠢,但我真的不知道如何设置

部分类别:

部分类测试
继承System.Web.UI.Page
受保护的子cmb\u mapa\u Click(ByVal sender作为对象,ByVal e作为System.EventArgs)处理cmb\u mapa。Click
Page.ClientScript.RegisterStartupScript(Me.GetType(),“testando”,“testando”(&nr_latitudeTextBox.Text&“,&nr_longitudeTextBox.Text&“),True)
端接头
末级

testando
第一个参数是图像url,您没有提供它

似乎您想调用
fonte
而不是
testando
在您的
RegisterStartupScript
上。这是一种以纬度和经度为参数的方法

编辑

改变

var src = "http://maps.google.com/maps/api/staticmap?center=lat,lon&zoom=8&size=540x280&ma‌​ptype=roadmap&sensor=false"
testando("http://maps.google.com/maps/api/staticmap?center=lat,lon&zoom=8&size=540x280&maptype=roadmap&sensor=false", 540, 280, "Mapa");

修正了两件事:

1) 您没有使用
lat
lon
作为地图url的参数,因此固定了
src
构建


2) 添加了
src
作为
testeando
的参数,因为您没有使用它

我将RegisterStartupScript更改为fonte,我的函数
fonte
的最后一行改为:testando(src,540280,“Mapa”);但现在,它只显示一个蓝色的图像,而不是我的地图。我认为(不确定)问题出在这一行:
var src=”http://maps.google.com/maps/api/staticmap?center=lat,lon&zoom=8&size=540x280&maptype=roadmap&sensor=false”center=lat,lon
,但真的不知道。。。
var src = "http://maps.google.com/maps/api/staticmap?center=" + lat + "," + lon + "&zoom=8&size=540x280&ma‌​ptype=roadmap&sensor=false";
testando(src, 540, 280, "Mapa");