By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,146 Members | 565 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,146 IT Pros & Developers. It's quick & easy.

Javascript won't load in Ajax-tabs - need to refresh page for tab to load

P: 3
I have an ajax powered tabs box that has a javascript drop-down search menu in the first tab. When I click on another tab, and go back to the first tab I have to refresh the page to get the information to load. Any suggestions on how I might get around that. The articles tab is the tab where the javascript won't load. Thanks so much for any help you might be able to provide:

This is what the tabs code looks like:
[HTML]<ul id="maintab" class="shadetabs">
<li class="selected"><a href="#default" rel="ajaxcontentarea">Articles </a></li>

<li><a href="ext_journals.htm" rel="ajaxcontentarea">Journals</a></li>&nbsp;
<li><a href="ext_databases.htm" rel="ajaxcontentarea">Databases</a></li>&nbsp;
<li><a href="ext_subjects.htm" rel="ajaxcontentarea">Subject Guides</a></li>&nbsp;
<li><a href="ext_catalog.htm" rel="ajaxcontentarea">Catalog </a></li>

The javascript for the menu is:
<script language="javascript">

// Initialize array

var arr = new Array();

arr[arr.length] = new Array("Find articles in these popular databases: ");

arr[arr.length] = new Array("Academic Search Premier (All Subjects)", ";db=aph&bquery=");

arr[arr.length] = new Array("Blackwell Reference (All Subjects)", "");

arr[arr.length] = new Array("Grove Art Online", " subview=search_subject&session_name=eb4d4b45702ec8 ca8bcfab3e41f6c37c&query=");

arr[arr.length] = new Array("Grove Music Online", " subview=search_subject&session_name=eb4d4b45702ec8 ca8bcfab3e41f6c37c&query=");

arr[arr.length] = new Array("Ingenta (All Subjects)", "; jsessionid=7j7jnqjc1l2rj.victoria?title=");

arr[arr.length] = new Array("Library Literature (Library Science)", " prod=LIBFT&query=");

arr[arr.length] = new Array("Oxford Reference Online", " ?y=0&q=");

arr[arr.length] = new Array("Proquest (Social Sciences, Nursing)", " ?RQT=305&querySyntax=PQ&searchInterface=1&clientId =15109&JSEnabled=1&SQ=");

arr[arr.length] = new Array("PubMed (Health Sciences, Medicine, Nursing)", " ?SUBMIT=y&db=PubMed&cmd=search&term=");

arr[arr.length] = new Array("SMART Imagebase (Medical Illustrations/Charts)", " ?A=1189&I=1189&TL=1281&ExhibitKeywords=");

arr[arr.length] = new Array("Springerlink/Kluwer (All Subjects)", " ?k=");

arr[arr.length] = new Array("Women and Social Movements: Scholar's Ed.", "");
// etc...

// Add options to list

function addOptions()


var sel = document.searchForm.whichEngine;

for(var i = 0; i < arr.length; i++)


sel.options[i] = new Option(arr[i][0], i);



// Get url for search engine

function startSearch()


searchString = document.searchForm.searchText.value;

if(searchString != "")


var searchEngine = document.searchForm.whichEngine.selectedIndex;

var finalSearchString = arr[searchEngine][1] + searchString;

location.href = finalSearchString;


return false;


// Check if key pressed == enter

function checkKey()


if(window.event.keyCode == '13')


return startSearch();


else return true;



<SCRIPT language=JavaScript type=text/javascript>


<!-- Begin

function formHandler(form){

var URL =[].value;

window.location.href = URL;


function expandDiv(tlll) {

what = eval(tlll + "_menu");

if ( == "none") { = "";


else = "none";


var oldc = new Array;

function cCell(r,m){

if(!document.all) return;













// Jump to a page


function jump() {

parent.location = document.links.url.options[document.links.url.selectedIndex].value;



// End -->

function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;


function MM_preloadImages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}


function MM_findObj(n, d) { //v4.0

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

if(!x && document.getElementById) x=document.getElementById(n); return x;


function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}



Mar 29 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
If the page contains JavaScript, it needs to be eval-ed or added to the main page (the head) for the JavaScript to run.
Jun 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.