-
Dec 12th, 2008, 11:49 AM
#1
Thread Starter
New Member
How VB6 use some function from .js (javascript)
Hi, I'm new in this forum
I'm doing some project. I receive data from microcontroller to Activex (write in VB6 and embed in IE). It's can store data already. now I need to send data to Moodle (LMS) with SCORM Standard. I must use some function from .js (like LMSInitialize() ). How VB6 use some function from javascript? May someone advice me? i.e.
Click button --> use LMSInitialize()
Thank you.
Sorry, I'm not good in English
-
Dec 12th, 2008, 11:53 AM
#2
Re: How VB6 use some function from .js (javascript)
Welcome to the forums.
VB doesn't use java script functions, and javascript doesn't use VB functions.
They each use their own.
Why are you mixing and matching the two languages (or trying to anyway)?
-
Dec 12th, 2008, 12:07 PM
#3
Thread Starter
New Member
Re: How VB6 use some function from .js (javascript)
Thank you Hack. May you advice me?
How to share data in variable between VB6 and Javascript
Can I send data that I store in VB6 pass to Javascript's Variable? by use ajax , write to XML (and pull by javascript) ......
anyone have some code please.
Thank you very much
-
Dec 12th, 2008, 01:54 PM
#4
Re: How VB6 use some function from .js (javascript)
You want to click a button in a VB application and then execute a Java script function that is on a webpage? You want to take some data in VB and pass that data to the Java script. Do you want also to have VB get data from a Java script?
-
Dec 12th, 2008, 11:44 PM
#5
Thread Starter
New Member
Re: How VB6 use some function from .js (javascript)
1+2 jmsrickland. I want to have javascript get data from VB when I click a button in ActiveX then passing variable to store in javascript
Originally Posted by jmsrickland
You want to click a button in a VB application and then execute a Java script function that is on a webpage? You want to take some data in VB and pass that data to the Java script. Do you want also to have VB get data from a Java script?
-
Dec 13th, 2008, 01:08 AM
#6
Re: How VB6 use some function from .js (javascript)
Well I don't know about your ActiveX but below is one way to pass a value from a VB application to a JavaScript. If this isn't exactly what you need maybe you can take it from here and apply it to your particular needs.
Below is sample HTML source code with JavaScript function
Code:
<html>
<body>
<form>
<script language="javascript">
function my_javascript_function(arg1)
{
alert("Value from VB Application = " + arg1);
}
</script>
</form>
</body>
</html>
Below is simple VB code to pass value to JavaScript function. Use a WebBrowser Control on your Form for this same to work.
Code:
Private Sub Command1_Click()
WebBrowser1.Navigate App.Path & "\JavaScript.html"
End Sub
Private Sub Command2_Click()
WebBrowser1.Document.parentWindow.execScript ("my_javascript_function('Hello from VB Application');"), "JScript"
End Sub
-
Dec 18th, 2008, 10:47 AM
#7
Thread Starter
New Member
Re: How VB6 use some function from .js (javascript)
Thank you. I'm try your code and have problem with Microsoft Internet Control (File not found: 'C:\WINDOWS\system32\ieframe.dll\1) I'm using IE7 VB6 crash after run the code. (I'm looking around forum for solve a problem) anyway if you advice please
-
Dec 18th, 2008, 11:02 AM
#8
Re: How VB6 use some function from .js (javascript)
-
Dec 19th, 2008, 01:55 PM
#9
Thread Starter
New Member
Re: How VB6 use some function from .js (javascript)
It's work great. Thank you jmsricklan. in
vb Code:
Private Sub Command2_Click()
WebBrowser1.Document.parentWindow.execScript ("my_javascript_function('Hello from VB Application');"), "JScript"
End Sub
If I need to replace 'Hello from VB Application' with <table><tr><td>some variable from texbox</td></tr></table>
How to write a code?
-
Dec 19th, 2008, 02:54 PM
#10
Re: How VB6 use some function from .js (javascript)
Originally Posted by narudol
It's work great. Thank you jmsricklan. in
vb Code:
Private Sub Command2_Click()
WebBrowser1.Document.parentWindow.execScript ("my_javascript_function('Hello from VB Application');"), "JScript"
End Sub
If I need to replace 'Hello from VB Application' with <table><tr><td> some variable from texbox</td></tr></table>
How to write a code?
Without testing it I would say you can do this:
Code:
Private Sub Command2_Click()
Dim OutputString As String
OutputString = "my_javascript_function(" & "'<table><tr><td>" & Text1.Text & "</td></tr></table>'" & ");"
WebBrowser1.Document.parentWindow.execScript (OutputString), "JScript"
End Sub
-
Dec 21st, 2008, 07:05 AM
#11
Thread Starter
New Member
Re: How VB6 use some function from .js (javascript)
I'm working with SCORM and Management system (moodle). now my activex (vb) can embed in html already. But WebBrowser Control open a target html form inside the box. It's can't communicate with moodle. Can I embed activex and form in same html file and passing variable from activex direct to form in same page? i.e. I click and browser can record a String somewhere now put it in html form. Thank You.
P.S. in Moodle's SCORM Module We can't direct access to html file directly. html file must play by Moodle's SCORM Reader. SCORM Package is Server side file but My Activex is Client Side. I can't send variable to html file that i don't know a URL
Last edited by narudol; Dec 21st, 2008 at 09:00 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|