Ways to interact with browser scripts (i)

Source: Internet
Author: User
Tags iis root directory
interaction | scripting | browser

1. Geturl send information to the browser
Format: GetURL ("Address", "Receive Window", "mode")
Example:

Build a TEST.FLA document, the first frame
Build three button (BTU1,BTU2,BTU3)
Build a TextInput (INPUT1)

As script:

function Opensite () {
This.geturl ("http://www.macromedia.com", "_self");
}
var str:string;
function Passva () {
str = This.input1.text;
This.geturl ("http://localhost/test.asp", "_blank", "get");
}
function Increase () {
This.geturl ("Javascript:alert (' Say hello! ')");
}
Btu1.addeventlistener ("Click", Mx.utils.Delegate.create (this, opensite));
Btu2.addeventlistener ("Click", Mx.utils.Delegate.create (this, passva));
Btu3.addeventlistener ("Click", Mx.utils.Delegate.create (this, increase));

Build the document test.asp on the IIS WEB server and add the following statement:

<form name= "Form1" method= "Post" action= "" >
<input type= "text" name= "TextField" value=<%=request.querystring ("str")%>>
</form>

FLA Routines: Click to download source files
1. Loadvariables class
GetURL can only send data to the script, not receive the script, and loadvariables .

Example
ASP script , codepage= "65001" is to enable the script to support Unicode, the document is placed under the IIS WEB SERVER root directory: <%@ Language= "JAVASCRIPT" codepage= "65001"%>
<%

Restr= "Hi," +request.form ("str")
Response.Write ("Rebackdata=" +restr)
%>

<% @LANGUAGE = "JAVASCRIPT" codepage= "65001"%>
<%

Restr= "Hi," +request.form ("str")
Response.Write ("Rebackdata=" +restr)
%>

Flash Movie, create a MC(mc1_int) in the scene, with a component Button (BTU1) and a Label (Label1) .
The first frame of the scene as

function Recievedara () {
This.loadvariables ("http://localhost/pass.asp", "POST");
}
_root.mc1_int.btu1.addeventlistener ("Click", Mx.utils.Delegate.create (_root.mc1_int, Recievedara));

Instance mc1_int as :

Onclipevent (data) {
_root.mc1_int.label1.text = Rebackdata.tostring ();
}

Instance mc1_int component as , variable str is the content to be sent to the ASP script
var str = This.label1.text; Routines Click here to download the file

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.