PDA

View Full Version : AJAX TABS - Need Help



eriksnet
02-27-2009, 04:59 PM
I have THREE tabs: "title1", "title2", and "title3"

How do I get "title1" to always be selected when the page loads or reloads?

cript: DD Tab Menu
http://www.dynamicdrive.com/dynamicindex1/ddtabmenu.htm



Website: http://www.honestskin.com/home.htm



<div id="title">
<div id="title1" class="title1" >
<a href="conditions.htm" rel="4body"></a></div>
<div id="title2" class="title2">
<a href="types.htm" rel="4body"></a></div>
<div id="title3" class="title3">
<a href="brands.htm" rel="4body"></a></div>
</div>


<script type="text/javascript">
var myflowers=new ddajaxtabs("title", "body4")
myflowers.setpersist(true)
myflowers.setselectedClassTarget("title1")
myflowers.init()

myflowers.onajaxpageload=function(pageurl){
if (pageurl.indexOf("conditions.htm")!=-1){
provinces=new ddajaxtabs("condside1", "condside2")
provinces.setpersist(true)
provinces.setselectedClassTarget("link")
provinces.init()
}
else if (pageurl.indexOf("types.htm")!=-1){
provinces=new ddajaxtabs("types1", "types2")
provinces.setpersist(true)
provinces.setselectedClassTarget("link")
provinces.init()
}

else if (pageurl.indexOf("brands.htm")!=-1){
provinces=new ddajaxtabs("brands1", "brands2")
provinces.setpersist(true)
provinces.setselectedClassTarget("link") //"link" or "linkparent"
provinces.init()
}}


</script>

ddadmin
02-28-2009, 09:15 AM
Well, when you initialize your tabs, the second parameter in the function to call sets which tab should be selected by default:


<script type="text/javascript">
//SYNTAX: ddtabmenu.definemenu("tab_menu_id", integer OR "auto")
ddtabmenu.definemenu("ddtabs1", 0) //initialize Tab Menu with ID "ddtabs1" and select 1st tab by default
</script>

A value of 0 should translate into the first tab being selected when the page loads/ reloads.

eriksnet
03-01-2009, 01:44 AM
Thank you, but I still can't get the script to pick "title" upon page load. What could I be doing wrong? This is placed in the head right?



<script type="text/javascript">
myflowwers.definemenu("title", "0")
</script>

ddadmin
03-01-2009, 07:46 AM
I'm confused actually. I assumed you were talking about DD Tab Menu from the link to the DD script in question, but your code snippet that followed corresponds to Ajax Tabs Content. Which one are you talking about?

eriksnet
03-01-2009, 03:53 PM
I obtained the script from: Ajax Tabs Content Script (v 2.2) on dynamicdrive.com.

I'm sorry for the confusion.

Can you still help?