PDA

View Full Version : Ajax Tabs Persist Feature On Dropdown Menu



Mkjones
08-18-2011, 11:01 AM
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: I have used code found on this forum to use a drop down menu instead of the tabs. Works great but I seem to have lost the persist feature. Any ideas how I can get it back? On page load nothing shows until I make another selection.

Code I am using:


<h2>Sub Categories</h2>

<center>
<form id="aform">
<select id="countrytabs" size="1" style="text-align: center; background: #ecf4ff;">
<option value="nothing">Select Category</option>
<option value="#"></option>
<option value="/photoshopsuk/files/all_cams.html">All Cameras</option>
<option value="/photoshopsuk/files/canon.html">Canon Cameras</option>
<option value="/photoshopsuk/files/fuji.html">FujiFilm Cameras</option>
<option value="/photoshopsuk/files/kodak.html">Kodak Cameras</option>
<option value="/photoshopsuk/files/nikon.html">Nikon Cameras</option>
<option value="/photoshopsuk/files/panasonic.html">Panasonic Cameras</option>
<option value="/photoshopsuk/files/videos.html">Videos - Reviews</option>
<option value="#"></option>
<option value="/photoshopsuk/files/close.html">(close)</option>
<option value="#"></option>
</select>
</form>
</center>
<script type="text/javascript">

var selectmenu=document.getElementById("countrytabs")
selectmenu.onchange=function(){ //run some code when "onchange" event fires
var chosenoption=this.options[this.selectedIndex] //this refers to "selectmenu"
if (chosenoption.value!="nothing"){
countries.loadajaxpage(chosenoption.value)
}
}

</script>

<div id="countrydivcontainer" style="border:1px solid #D1D1D1; width: 188px; margin-top: 0px; margin-bottom: 0px; padding: 0px">
</div>

<script type="text/javascript">

var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
countries.setpersist(true)
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.init()

</script>

Menu can be seen here:

http://cam-shots.co.uk/photoshopsuk/

Regards
Mark