在js的代码中,有一个函数,需要从VB中获得变量,除了从&Text&中,还有别的办法吗
WebBrowser1.Document.parentWindow.execScript "labellong = " & Text1 & "", "javascript" '经度
WebBrowser1.Document.parentWindow.execScript "labellat ="" & Text2 & "", "javascript" '纬度
WebBrowser1.Document.parentWindow.execScript "radioname = " & Text3 & "", "javascript" '标识
'WebBrowser1.Document.parentWindow.execScript "theLocation()", "javascript" '定位
WebBrowser1.Document.parentWindow.execScript "BMap.Convertor.translate(new BMap.Point(" & Text1 & "," & Text2 & "),0,translateCallback)", "javascript" '精度纠正当我把 " & Text1 & "改成数字时程序能用,当我改成变量的时候不能用了,怎么才能用变量呢
WebBrowser1.Document.parentWindow.execScript "labellong = " & Text1 & "", "javascript" '经度
WebBrowser1.Document.parentWindow.execScript "labellat ="" & Text2 & "", "javascript" '纬度
WebBrowser1.Document.parentWindow.execScript "radioname = " & Text3 & "", "javascript" '标识
'WebBrowser1.Document.parentWindow.execScript "theLocation()", "javascript" '定位
WebBrowser1.Document.parentWindow.execScript "BMap.Convertor.translate(new BMap.Point(" & Text1 & "," & Text2 & "),0,translateCallback)", "javascript" '精度纠正当我把 " & Text1 & "改成数字时程序能用,当我改成变量的时候不能用了,怎么才能用变量呢
labellong = 1
数字是常量,当然可以正确赋值。
labellong = v
变量v在javascript 的作用域中是未定义的啊,labellong的值当然是undefined了。