Home > Software engineering >  Vb use webbrower controls, call their written in JavaScript web page, how to js in vb variable assig
Vb use webbrower controls, call their written in JavaScript web page, how to js in vb variable assig

Time:09-26

In js code, there is a function that needs to be obtained from VB variables, apart from & amp; Text& Is there any other way,
WebBrowser1. Document. ParentWindow. ExecScript "labellong=" & amp; Text1 & amp; "" and" javascript "' longitude
WebBrowser1. Document. ParentWindow. ExecScript "labellat=" "& amp; Text2 & amp; "" and" javascript "latitude '
WebBrowser1. Document. ParentWindow. ExecScript "radioname=" & amp; Text3 & amp; "" and" javascript "' logo
'WebBrowser1. Document. ParentWindow. ExecScript theLocation "()", "javascript"' positioning
WebBrowser1. Document. ParentWindow. ExecScript "BMap. Convertor. Translate (new BMap. Point (" & amp; Text1 & amp; ", "& amp; Text2 & amp; "), and 0, translateCallback) ", "javascript" 'correcting accuracy



When I put the "& amp; Text1 & amp; "Into a digital program can be used, when I changed to variable cannot be used, how to use variable

CodePudding user response:

This has nothing to do with Text1 use cash or variable, but javascript is the scope of the page, and VB has nothing to do,
 labellong=1 

Digital is a constant, of course I can correct assignment,
 labellong=v 

The scope of the variable v in javascript in is undefined, labellong value is undefined, of course,

CodePudding user response:

, didn't see the parameters of the WINHTTP instructions carefully

CodePudding user response:

New BMap. Point (" & amp; Text1 & amp; ", "& amp; Text2 & amp; "), and 0, translateCallback) changed to:

New BMap. Point (a, b), 0 translateCallback), 'of course not, because a and b are declared in vb, to try the following:

new BMap. Point (" & amp; A. & amp; ", "& amp; B & amp; "), and 0, translateCallback)
  • Related