# Structure of the code

Two methods can be used in order to, for example, create a DFrame from of a page inserted in a DFrame:

Do every thing in the inserted HTML page

In the inserted page :

function createDFrame() {

var dFrame = new mainPage.DFrame(parameters)

dFrame.setURL(url)

}

Do everything in mainPage

In the inserted page :

function createDFrame (url) {

mainPage.createDFrame(url)

}

In mainPage :

function createDFrame(url) {

var dFrame = new DFrame(parameters)

dFrame.setURL(url)

}

Note: The two functions, in mainPage and the inserted HTML page, have in the second example the same name what is possible but obviously not mandatory.

The first way needs code in the inserted pages so, every time it is possible, the second way should be preferred in order to have most of the Javascript code in the same location.