getDFrameValues.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/clean/styleClean.js')

 

     //define outPutDFrame as a global

     var baseAll

     var inputDFrame  

     var outputDFrame

     var value

 

     DFrameAPI.onLoad = function(){   

          DFrameAPI.checkStyles(false)

          //Instanciate the first dFrame

          baseAll = new DFrame([0, 0, 100, 100], 'getDFrameValues.html', dFrameStyle);

          var txt = 'If you click on the \'copyToAnotherDFrame\' Button:'

          txt +='<br>The function behind this Button gets the value you entered in the form'

          txt +='<br>and opens the output.html page in a new DFrame.'

          txt +='<br>The Javascript code in this page will use the \'mainPage\' keyword'

          txt +='<br>but needs before the getDFrameValues function to get a handle on mainPage.'                                    

          var txt = baseAll.addText([15, 5], txt)

          txt.setImageNormal(null)

         

          //Create the input dFRame

          inputDFrame = new DFrame([10, 30, 40, 60], 'input.html', dFrameStyle, baseAll);

          inputDFrame.addButton('Copy to another DFrame', 'copyToAnotherDFrame()')

          inputDFrame.setURL('./getDFrameValues/input.html')

     }

     function copyToAnotherDFrame(url) {

          if (!outputDFrame) {

              outputDFrame = new DFrame([50, 30, 80, 60], 'output.html', dFrameStyle, baseAll)

          }

          //Get the value of the text field of inputDFrame and store it in the global 'value' variable

          //The onLoadDFrame function of output.html will read it.

          var value = inputDFrame.window.document.forms[0].inputField.value

         

          //3rd parameter forces to always refresh the page

          //The output.html page will have to use the getDframeValues to write value

          outputDFrame.setURL('./getDFrameValues/output.html', null, true)

     }

</script>

</HEAD>

</HTML>

input.html

<HTML>

<HEAD>

</HEAD>

<BODY>

<form Method=post Action="null action for this form">

     <input name=inputField type=text value="You can modify that.">

</form>

</BODY>

output.html

<HTML>

<BODY>

This is HTML code stored in output.html<br>

but that: "

<font color=red familly=Arial>

<script>

     //Call getDFrameValues as mainPage is not yet known

     if (window.parent && window.parent.getDFrameValues) window.parent.getDFrameValues()    

     document.write(mainPage.value)

alert('done')  

</script>

</font>

" comes from input.html

</BODY>