Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_objects thread: Re: Parameter passing from JavaScript into an ActiveX object


Message #1 by Greg Griffiths <greg2@s...> on Sun, 06 Oct 2002 18:30:40 +0100
Here is the HTML, along with the Delphi function which it calls:

<HTML>
<H1> Delphi 6 ActiveX Test Page </H1><p>
You should see your Delphi 6 forms or controls embedded in the form 
below.
<HR><center><P>
<OBJECT
    id=3DFreshProof
	  classid=3D"clsid:C17372E5-D6B2-11D6-ABFE-0008C7CAC500"
	  codebase=3D"C:/FreshProof/FreshProofProj.ocx#version=3D1,0,0,0"
	  width=3D150
	  height=3D55
	  align=3Dcenter
	  hspace=3D0
	  vspace=3D0
>
</OBJECT>
<form name=3D"myForm">
<input type=3D"text"  name=3D"_t1" value=3D"Hello, World...">
<input type=3D"text" name=3D"_t2" value=3D"Goodbye, Cruel World!  I'm 
going to Free myself.">
</form>
<SCRIPT LANGUAGE =3D "JavaScript">
function callvarfunc(){
FreshProof.VarIn(myForm);
}
</SCRIPT>
<a href=3D"javascript:callvarfunc()">CallVarFunc</a>
</HTML>



procedure TFreshProof.VarIn(FormObject: OleVariant);
var
  i:integer;
  s1:string;
begin
(*  s1 :=3D formObject.elements[1].value; // this doesn't work*)
  s1 :=3D formObject.elements._t1.value;  // but this does
  s1:=3D'new string';
  formobject.elements._t1.value:=3Ds1;
end;

I can send data both ways, a big improvement lately, but I'd like to be 
able to index the elements instead of using their names.


Kirk

  Return to Index