PDA

View Full Version : Using javascript in Ajax Tabs Content's tabs?



bjesus
06-21-2007, 08:34 PM
1) Script Title:
Ajax Tabs Content script

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

3) Describe problem:
One of the pages I use as a tab has a few rows of simple javascript code - it toggles the visibility of a some item. When watching the page alone, it works fine, but when it's included as a tab it seems that everything inside a <script> tag is simply ignored, and I can't toggle the item.

What can I do?
I've read you don't support using the same script twice or stuff like that, but it's not a script problem, it's that I can't write *any* script at all in the tab...

Thank you!

mhancoc7
07-20-2007, 03:58 AM
This is how I get javascript to work in the Ajax Tabs script.

Instead of referencing the page directly in the Ajax Tabs I use and iframe. First I create an html file and add iframe code to reference the page that I actually want to appear in the tab content area. Then in the tab script I reference the iframe html file and it pulls in the actual content. This way the javascript gets loaded and the tabs work great.

You can check out some examples on my site. www.whatwouldjesusdownload.com

The news section is an RSS to Javscript feed.

I hope this helps.

I may post a How To for this if it is helpful.

Thanks, Jereme

jscheuer1
07-20-2007, 05:30 AM
Sounds feasible, mhancoc7. And, since you're using it that way, it must work. Another workable (for many cases) approach is outlined here:

http://www.dynamicdrive.com/forums/showthread.php?t=17426

mhancoc7
07-20-2007, 03:51 PM
Sounds feasible, mhancoc7. And, since you're using it that way, it must work. Another workable (for many cases) approach is outlined here:

http://www.dynamicdrive.com/forums/showthread.php?t=17426

Yeah, it is a little tricky getting the iframes just right especially if you are using the script in a joomla template like me. :)

I like your method, but I never got around to trying it. My iframe idea came to me in my sleep, literally.

Thanks, Jereme