View Full Version : Loading another script into ajax content

05-02-2008, 12:52 PM
1) Script Title: Ajax Tabs Content Script (v 2.2)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm

3) Describe problem:

<ul id="countrytabs" class="shadetabs">
<li><a href="#" class="selected" rel="#default">Tab 1</a></li>
<li><a href="external2.htm" rel="countrycontainer">Tab 2</a></li>
<li><a href="external3.htm" rel="countrycontainer">Tab 3</a></li>
<li><a href="external4.htm" rel="#iframe">Tab 4</a></li>
<li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li>

<div id="countrydivcontainer" style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">
//Optional default content here.

I want to use another script in external2.htm but i dosn`t works! :eek:

somebody has an idea?

05-02-2008, 02:14 PM
AJAX doesn't load scripts. Use the rel="#iframe" method for that page.

05-02-2008, 02:23 PM
hello -

Yes - i use iframe for the scripts! but the thing is, if the user click on "send" (textbox for comments) - Ajax dosn`t load the first page #default!

And thatīs why i`m asked! :(

is there a way to point the iframe tab after reloading to #default? If i choose in the iframe-link target=_top oder target=_parent the tab will come alone!

05-02-2008, 02:41 PM
This now sounds like a separate issue. Instead of running a script, now you want to link from inside one tab to another tab, is that correct? Do you need to do both (run a script in a tab and from the same tab also be able to link to another tab)?

05-02-2008, 02:50 PM
i have 3 tabs...

Read comments (Default) - Make a comment - Info

so if the user writing now a comment - after sending he will jump to Read comments)

and now my problem -

i need for textboxes 1 script (Editor) In the <head> i`m loading it and the textbox got an id and this works but ajax block this script! :rolleyes:

Than - i was using iframe - works good but the only one thing is - if the user now send the comment he will see the comment box again and if i use target=_top - the comment box will come alone! :(

is there a way - to use the #default function in iframe?

05-02-2008, 02:54 PM
is here a place free to say ajax load #default?

<input type="submit" value="Send" class="input">

05-02-2008, 03:15 PM
I'm having a little trouble understanding you because I think you aren't using the technical terms I am used to when describing the situation. I do understand the overall idea pretty much though.

To get an iframe to run a function on the top page, say the function on the top page is:

function hi(){alert('Hello!');

In the iframe you would call:


If you have:

<ul id="countrytabs" class="shadetabs">
<li><a href="#" class="selected" rel="#default">Tab 1</a></li>
. . .


var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
. . .

on the top page, you should be able to do this from inside the iframe:

<a href="javascript:top.countries.expandit(0);">Whatever</a>

to create a link to the default tab that will be displayed in the tabs. However, passing information to it, will not work using this method. You may need to reload the top page in order to do that, or at least modify the script somewhat. Are you trying to pass information from the iframe to the top page, or just trying to get the top page to display its default content that it has stored in a javascript variable?