JS obtains OCX data

Source: Internet
Author: User

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>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.