Submit form using javascript

Simply to submit a form using javascript you can write:

In the following code you will see a special case where the form is not appearing directly on the page but through an iFrame element.


This code tested on Chrome, FF, IE and Safari Windows.


Source Code

Call container page function from child iframe

The simplest way i got to call a function that exists in the iframe container page is using:


<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <script language="javascript" type="text/javascript">
            function AlertFromParent() {
                alert('I am parent');
        <iframe src="IFramePage.aspx" id="myIframe">





– This function is working just if the 2 pages ‘the parent and the child’ are in the same domain name, and if they are in 2 different domains you will get permission denied error.

– If you will run the javascript code inside the iframe on load ‘as in the previous example’, make sure that the parent script function exists before the iframe tag, because the iframe will break loading the page till it finish loading and everything after it will wait till it completely loads.

Flash Javascript communication first look


I did a fast research about how to make flash interact with the container website, and i collected some good information.


There are 2 main techniques to implement communications between flash and the container website:


1- Client API technique:


Using this technique, the flash will communicate with the website through JavaScript.

So in brief, the flash can send and receive variable from the website using Javascript, and for this first research I got 2 main ways to make flash interact with Javascript:

a- Using the ExternalInterface which exist in the action script classes,,,


b- Using normal Javascript calls as in this example: which describes the main functions to interact with the flash using Javascript.

2- Server API technique:


Using this technique, flash will call the server side APIs directly, and will post variables to the API URL, also there is another way is to send these variables using Querystrings, which will not be the right way all the time and may be not possible in some cases ‘put in mind for example the max number of query string characters’.


Most of game websites use the server side APIs, but big famous website give both options, server or client side APIs.

Server Side advantages from my point of view:

– More secure calls.

– Works whatever the user enabled javascript in the browser or not.

– No problems with different browsers compatibilities.

Client Side advantages:

– Middle layer, between the server side code and the flash, which encapsulates the server side methods and don’t let the flash call the server APIs directly but will be through this JS layer.

– Gives the ability to submit values to the server using Ajax style ‘without refreshing the whole page’.

– The flash will need less information from the website, as the Javascript code will handle most of the common variables ‘such as the current user, the current page URL, …’.

By the way in both cases we will need to implement the server side API first and then will let the Javascript and flash code interact with this APIs.