:: Forum >>

Open new window with TAB click

Hi All,

I am new to ActiveWidgets, and this is my 1st posting so please take it easy on me...

Just a quick question, I am using the Tab control and have 5 tabs on it. I want the url to open in the current window for the 1st 4 tabs, but for the 5th tab, I need the url to open in a new window.

Basically, the 5th tab option is a print option, which then takes the user to a more 'printable' version of the page which does the onLoad="window.print()" upon opening.

My code currently looks something like this:-

<script language="JavaScript">
var tabs = new AW.UI.Tabs;
tabs.setId("tabs");
tabs.setItemText(["Overview", "Packaging", "Associated", "Alternative", "Print"]);
tabs.setItemImage([Overview", "Packaging", "Associated", "Alternative", "Print"]);
tabs.setItemLink("###tabs-url###&tab=over", 0);
tabs.setItemLink("###tabs-url###&tab=pack", 1);
tabs.setItemLink("###tabs-url###&tab=ass", 2);
tabs.setItemLink("###tabs-url###&tab=alt", 3);
tabs.setItemLink("###sheet-url###", 4);
tabs.setItemCount(5);
tabs.setSelectedItems([###tabs-number###]);
tabs.onItemClicked = function(event, i) { window.location = this.getItemLink(i); }
document.write(tabs);
</script>

I parse the html code through some PHP code before outputting it, this enables me to set certain values at runtime (eg, ###tabs-number### gets replaced with the currently selected tab etc).

TIA,

Andy
Andy Wilton
Tuesday, April 25, 2006

This topic is archived.


Back to support forum

Forum search