PDA

View Full Version : Ajaxtabs external div help



betterman2k12
07-09-2012, 03:39 PM
1) Script Title: Ajaxtabs

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

3) Describe problem:
I was trying to hide a div outside of the tabs with an onClick() event in the tab's link, but could not. Later, after some tinkering, i discovered that not even an in-line javascript alert would work with the onClick method. I'm fairly new to ajax implementation. The tabs are loaded as a search mechanism (included via php) site-wide, and on a particular page, i want to hide one of the divs on the page when one of the tabs are selected in particular. Is there no way to accomplish this?

the initialization:


<script type="text/javascript">

var searches=new ddajaxtabs("searchtabs", "searchcontainer")
searches.setpersist(true)
searches.setselectedClassTarget("link") //"link" or "linkparent"
searches.init()

</script>


and the other portion of the ajaxtabs:


<ul id="searchtabs" class="shadetabs" style="text-align:left; width:700px; margin: 0px auto">
<li><a href="<?=$site_url ?>example.php" rel="searchcontainer" class="selected">example</a></li>
<li><a href="<?=$site_url ?>example2.php" rel="searchcontainer" id="nppa" onClick="document.getElementById('hide_this').style.display='none';">example 2</a></li>
</ul>
<div id="searchcontainer" style="border:1px solid gray; width:700px; margin: 0px auto; padding: 10px; background:#1003cb url(/i/searchbox.png) no-repeat; text-align:center; -moz-border-radius: 15px; border-radius: 15px">

</div>

...

elsewhere on the page:


<div id="hide_this">
some content
</div>


Any way to make this work, or an alternative that may work for this?

Thanks for any help.

ddadmin
07-10-2012, 01:06 AM
If you look at demo #2 on the script page, it actually shows two arbitrary DIVs on the page that are being toggled as you click on the tabs to their left. See this page (http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/ajaxtabs_suppliment3.htm#eg1) for more info on how to set it up.

betterman2k12
07-10-2012, 12:07 PM
I missed that when i was reading through, thank you for pointing it out :)