PDA

View Full Version : new external link in same tab



Gil coder
03-15-2007, 08:19 AM
1) Script Title:
Ajax Tabs Content script
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/
3) Describe problem:
I'm trying to upload new external link in same tab.
can i do that?
how to?

ddadmin
03-15-2007, 09:47 AM
Do you mean load the contents of an external link (ie: http://google.com) inside your page via Ajax when a tab is clicked on? Unfortunately due to security reasons Ajax doesn't allow loading of external sites using it. Something like Tab Document Viewer (http://www.dynamicdrive.com/dynamicindex3/tabdocviewer.htm), which uses iframes, would be what you're describing.

Gil coder
03-15-2007, 11:04 AM
:( no.
lets say we are un the 3 tab and just load example_2.html and we want to load in the same tab example_3.html instade of example_2.html

Gil coder
03-15-2007, 12:00 PM
please help

ddadmin
03-15-2007, 10:41 PM
I see what you mean. So after loading an external page inside a DIV, you want that page to in turn contain a link that loads another page inside the same DIV, replacing itself?

There's currently no prebuilt way to do multiple levels of loading pages into a DIV. You can hack it, but it's not exactly intuitive. Inside ajaxtabs.js file, add to it at the very end the below function:


function directloadpage(tabcontentid, divid, tabnumber, url){
var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
ajaxpage(url, divid, thetab)
}

Then, to create a link inside one of your external pages that loads another external page in the same DIV it currently occupies, do something like:


<a href="javascript: directloadpage('maintab', 'ajaxcontentarea', 0, 'external4.htm' )">Load external page!</a>

Where

1) "maintab" is the ID of your Ajax Tabs (the <ul> tag)
2) "ajaxcontentarea" is the ID Of your DIV that contains the external pages loaded
3) 0 is the tab number that should be selected when the page is loaded. 0=first tab, 1=second tab etc.
4) And finally, "external4.htm" is the page on your server to load.

Yep, you'll need to jump through a few hoops right now if you want to accomplish the above. :)

p.s: Please don't start multiple threads on the same question. Dup deleted.