setTarget.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/blue/styleBlue.js')

//globals

var dFrameLeft

var textStyle

var dFrameStyleNoBgColor

var comment

DFrameAPI.onLoad = function(){

//Create a new style and discard contentBgColor property

dFrameStyleNoBgColor = new DFrameStyle(dFrameStyle)

dFrameStyleNoBgColor.setContentBgColor(false)

txtStyle = new ButtonStyle(buttonStyle)

//The Text must be over the Buttons of the Bar

txtStyle.setOverlayParentBars(true)

txtStyle.setWidth(0)

txtStyle.setBgNormal('#187E55')

//Add the left DFrame

dFrameLeft = new DFrame([1, 1, 30, 99], 'Left Frame', dFrameStyleNoBgColor);

//We need a bar on the TOP of the DFrame, with buttons from top to bottom

bar = dFrameLeft.addBar('TOP')

bar.setStartFrom('TOP')

//Although the Bar is set on the top if is a vertical Bar because of startFrom=TOP

//set autoWidth to empty string: The width will be the width of the parent DFrame

//set autoHeight to CONTENT: The height will be the height of the 2 Buttons.

bar.setAutoWidth('')

bar.setAutoHeight('CONTENT')

bar.setBordersWidth(1)

//Create an 'invisible' Text: Timer value is set to 0

comment = bar.addText([5, '10'], 0, txtStyle)

//Create a style for Buttons with images

var x = new ButtonStyle(buttonStyle)

x.setAutoWidth('LARGEST')

x.setLabelHAlign('LEFT')

x.setLabelLeftMargin(35)

x.setImageHMargin(5)

x.setImageVMargin(5)

x.setImageNormal('dFrame/doc/Reference/examples/setTarget/newWinNormal.gif')

x.setImageSelected('dFrame/doc/Reference/examples/setTarget/newWinSelected.gif')

var targetTrueButton = bar.addButton('setMultipleTarget:<br><b>true</b>', 'setTargetMultipleOrNot(thisDFrame, true)', x)

x.setImageNormal('dFrame/doc/Reference/examples/setTarget/sameWinNormal.gif')

x.setImageSelected('dFrame/doc/Reference/examples/setTarget/sameWinSelected.gif')

bar.addButton('setMultipleTarget:<br><b>false</b>', 'setTargetMultipleOrNot(thisDFrame, false)', x)

dFrameLeft.setTarget('openRightPage()')

dFrameLeft.setURL('./setTarget/leftPage.html')

dFrameLeft.setMultipleTarget(true)

targetTrueButton.setLook('Selected')

}

function openRightPage() {

//Use the DFrameCollector class to reuse closed DFrames

//define a key for this kind of dFrame

var key = 'keyForRightDFrame'

//look for a dFrame with this key in the dFrameCollector

var dFrame = DFrameCollector.find(key)

//if not found: create a new dFrame

if ( !dFrame ) {

//Special style methods so that dFrames are cascaded

dFrameStyleNoBgColor.setIndentX(40)

dFrameStyleNoBgColor.setIndentY(40)

dFrame = new DFrame([40, 20, 70, 50], 'Right Frame', dFrameStyleNoBgColor);

dFrame.addButton('Close', 'thisDFrame.closeFrame()')

}

//register the dFrame in the dFrameCollector for reuse

DFrameCollector.register(dFrame, key)

return dFrame

}

function setTargetMultipleOrNot(dFrame, b) {

dFrame.setMultipleTarget(b)

if (b) comment.setText('Links will be opened in new DFrames', 2)

else comment.setText('Links will be opened<br>in the same DFrame', 2)

}

</script>

</HEAD>

</HTML>

leftPage.html

<HTML>

<HEAD>

<script>

function onLoadDFrame(){thisDFrame.setContentBgColor('yellow')}

</script>

</HEAD>

<BODY BGCOLOR=YELLOW>

<br><br>

<a href = "rightPage1.html"> link for right page, blue</a>

<br><br>

<a href = "rightPage2.html"> link for right page, green</a>

<br><br>

<a href = "rightPage3.html"> link for right page, red</a>

<br><br>

<a href = "rightPage4.html"> link for right page, silver</a>

<br><br>

<a href = "rightPage5.html"> link for right page, olive</a>

<br><br>

<a href = "rightPage6.html"> link for right page, yellow</a>

<br><br>

<a href = "rightPage7.html"> link for right page, pink</a>

</BODY>

rightPageX.html

<HTML>

<HEAD>

<script>

function onLoadDFrame(){thisDFrame.setContentBgColor('blue')}

</script>

</HEAD>

<BODY BGCOLOR=BLUE>

<br>

</BODY>

</HEAD>

</HTML>