Pass javascript variable by reference to OCX

I have an OCX (developed by myself) to be used in a web page using javascript / vbscript.
I would like to pass a variable to the OCX and then change the value of the parameter inside the OCX and then pass the new value back to the JavaScript function. It would be great if the parameter can be of type string.

Is it possible to pass the address (pass by reference) of a javascript parameter to OCX.

thank you
Who is Participating?
If you explicitly return a value, then yes, that's what I suggested. What I was telling you was it is not possible is to change a variable passed without returning something.
No. All javascript parameters are by value only.

WScript users often have similar questions and the answer in WScript is that there is an alternate way to call a method such that the needed value is returned.

Good luck with your project!
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

WalterRautenbachAuthor Commented:
thanks guys. not really what I wanted. I did get a work-around though. How does it work with the points now? Although you tried, you did not give me the right answer :)  
You should post your answer and request a moderator refund your points after accepting your own solution. If they deem your question truly was unaddressed, your points will be refunded.

However, your question requested changing a (preferably) string type by reference...which is not possible, last I heard. If you've got new information on this, do share. :)

If you passed a javascript object and changed a property inside the object, then that's really a different way of solving your problem but it is not a new answer to the question. :-P

WalterRautenbachAuthor Commented:
Thanks. Yes I wanted to pass a variable to an ActiveX control and then change the value of that variable inside the ActiveX control and then pass the new value back to JavaScript. What I have done now is to leave the parameter route and rather return a BSTR* from the ActiveX control function to the calling JavaScript function. So I don't think I am changing a property of the object.

Is this what you guys said I shoud I do?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.