JS is really powerful. Let's see how it gets data in OCX.
<Form name = "form1" Action = "">
<Input type = "hidden" value = "<WW: property value = 'stdilurl'/>" name = "jpgurl"/>
<Input type = "hidden" value = "<WW: property value = 'stables. id'/>" name = "stencilid"/>
<Input type = "hidden" value = "0" name = "tag" id = "tag"/>
<Input type = "hidden" value = "http: // 10.10.240: 8080/box/stencilarea/stencilareaadd. Action" name = "urlstencer" id = "urlstencer"/>
<Input type = "hidden" value = "<% = request. getcontextpath () %>/createimagebyocx. Action" name = "urlimage" id = "urlimage"/>
</Form>
<P>
<Object ID = "docxtest1" width = "1035" Height = "768" class = "ocxposedt. OCX "classid =" CLSID: 5e365b7d-962f-421a-b4b2-332ab23af60d "codebase =" http: // 10.10.240: 8080/box/OCX/ocxposedt. cab # version = 0,000, ">
<Param name = "_ version" value = "65536" name = ""/>
<Param name = "_ extentx" value = "2646" name = ""/>
<Param name = "_ extenty" value = "1323" name = ""/>
<Param name = "_ stockprops" value = "0" name = ""/>
</Object>
</P>
<Script language = "JavaScript" for = docxtest1 event = postdata>
VaR strpostdata = docxtest1.postdata;
If (document. getelementbyid ("tag"). value = "0 "){
_ Sd_post (document. getelementbyid ("urlstencel"). Value, strpostdata );
} Else {
_ Sd_post (document. getelementbyid ("urlimage"). Value, strpostdata );
}
</SCRIPT>
<Script language = "JavaScript">
VaR XMLHTTP;
Function _ sd_post (URL, argS)
{
VaR error;
Eval ('try {XMLHTTP = new activexobject ("Microsoft. XMLHTTP");} catch (e) {XMLHTTP = NULL; error = E ;}');
If (null! = XMLHTTP)
{
XMLHTTP. onreadystatechange = processrequest;
XMLHTTP. Open ("Post", URL, false );
XMLHTTP. setRequestHeader ("Content-Type", "application/X-WWW-form-urlencoded ");
XMLHTTP. Send (ARGs );
}
Else
{
Location. href = "<% = request. getcontextpath () %>/error. jsp ";
}
}
Function processrequest (){
If (XMLHTTP. readystate = 4 ){
If (XMLHTTP. Status = 200 ){
VaR strtext = XMLHTTP. responsetext;
Alert (strtext );
// If our response starts with HTTP than Redirect there
If (strtext! = NULL & strtext. tolowercase (). indexof ("OK") = 0)
{
Location. href = "<% = request. getcontextpath () %>/OK. jsp ";
}
} Else {
Alert ("not able to retrieve description" + Req. statustext );
}
}
}
</SCRIPT>
<Script language = "VBScript" type = "">
<! --
Docxtest1.tag = "0"
Docxtest1.stencilid = form1.stencilid. Value
Docxtest1.jpgurl = form1.jpgurl. Value
-->
</SCRIPT>