mainPageAccess.html
<HTML>
<HEAD>
<script>var dFrameFilePath =
'../../../../../dFrame/'</script>
<script language="Javascript"
src="../../../../../dFrame/dFrame/lib/DFrameAPI.js"></script>
<script language="Javascript">
//Style
DFrameAPI.include('dFrame/styles/Windows/styleWindows.js')
//globals
var message = 'This is
stored in mainPage.'
DFrameAPI.onLoad =
function(){
dFrame = new
DFrame([10, 10, 90, 90], 'mainPageAccess.html', dFrameStyle);
var bar =
dFrame.addBar()
bar.setBgImage('')
bar.setAutoHeight('CONTENT')
var txt = 'call createDFrame function:'
txt +=
'<br>- The code calls the createDFrame function stored in page.html.'
txt +=
'<br>- This code will use the \'mainPage\' keyword to call the
createDFrame function of mainPage'
bar.addText(null,
txt)
//Call the
createDFrame function stored in page.html
//This function
will call the createDFrame function below.
dFrame.addButton('call
createDFrame function', 'thisDFrame.window.createDFrame()')
dFrame.setURL('./mainPageAccess/page.html')
}
function createDFrame() {
alert('... and this is
the createDFrame function in mainPage')
//Instanciate and
create a DFrame
var dFrame = new
DFrame([20, 20, 80, 80], 'created by createDFrame function', dFrameStyle);
dFrame.show()
}
</script>
</HEAD>
</HTML>
page.html
<HTML>
<HEAD>
<script>
//As the code of those
functions is executed in page.html: use mainPage keyword
//to access ressources
of mainPage
function alertValue() {
alert(mainPage.message)
}
function createDFrame()
{
alert('This is the
createDFrame function in the page inserted in the dFrame.\nIt will call the
createDFrame function of mainPage')
mainPage.createDFrame()
}
</script>
</HEAD>
<BODY>
Javascript in page.html:<br>
<script><br>
function createDFrame() {<br>
alert('This
is the createDFrame function in the page inserted in the dFrame...')<br>
mainPage.createDFrame()<br>
}<br>
</script>
</BODY>