Tab Issue
I need to pass [Tab#] and [URL] from a link located outside the tab area to change the tab content without refresh the page.
I need something like:
<a href="#" onclick="tab_changer('0','page2.php)">link</a>
I'ts that possible?
Thank you.
Andres
December 10,
Stop creating duplicate posts. This not help you to get a faster reply.
Paulo Cesar (PC from Brazil )
December 10,
That's very helpful. Paulo, Thank you!
Andres
December 10,
Andres, when you say 'tab issue' - you mean that you are using AW.UI.Tab class?
Alex (ActiveWidgets)
December 10,
Alex, yes... an example:
var names = ["Tab01", "Tab02", "Tab03"];
var values = ["1.asp", "2.asp", "3.asp"];
var tabs = new AW.UI.Tabs;
tabs.setId("myTabs");
tabs.setItemText(names);
tabs.setItemValue(values);
tabs.setItemCount(3);
tabs.refresh();
tabs.onSelectedItemsChanged = function(selected){
var index = selected[0];
var value = this.getItemValue(index);
window.status = index + ": " + value;
var http = new AW.HTTP.Request;
http.setURL(value);
http.response = function(text){
document.getElementById("myContent").innerHTML = text;
}
http.request();
}
tabs.setSelectedItems([0]);
what i need its a function or somthing to change the current tab content URL.
I did try:
function changetab(tab,url){
var index = tab;
var value = url;
window.status = index + ": " + value;
var http = new AW.HTTP.Request;
http.setURL(value);
http.response = function(text){
document.getElementById("myContent").innerHTML = text;
}}
<a href="#" onClick="changetab('1','2.asp')">click here</a
but doesn't work.
Thank you.
Regards.
Andres M.
Andres
December 10,
I guess you are just missing the last statement which sends the request:
http.request();
Alex (ActiveWidgets)
December 10,
Alex, it worked. Thank you.
Here is the final code:
function changetab(tab,url){
tabs.setSelectedItems([tab])
var index = tab;
var value = url;
var http = new AW.HTTP.Request;
http.setURL(value);
http.response = function(text){
document.getElementById("myContent").innerHTML = text;
}
http.request();
}
Usage:
onClick="changetab('0','2.asp')
Andres
December 10,