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

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

P: 3
Hi,
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>
</ul>


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)", "http://ezproxy.twu.edu:2048/login?url=http://search.ebscohost.com/login.aspx?direct=true&amp;db=aph&bquery=");

arr[arr.length] = new Array("Blackwell Reference (All Subjects)", "http://ezproxy.twu.edu:2048/login?url=http://www.blackwellreference.com/subscriber/uid=649/search?query=");






arr[arr.length] = new Array("Grove Art Online", "http://ezproxy.twu.edu:2048/login?url=http://www.groveart.com/shared/views/search_results.html? subview=search_subject&session_name=eb4d4b45702ec8 ca8bcfab3e41f6c37c&query=");


arr[arr.length] = new Array("Grove Music Online", "http://ezproxy.twu.edu:2048/login?url=http://www.grovemusic.com/shared/views/search_results.html? subview=search_subject&session_name=eb4d4b45702ec8 ca8bcfab3e41f6c37c&query=");

arr[arr.length] = new Array("Ingenta (All Subjects)", "http://ezproxy.twu.edu:2048/login?url=http://www.ingentaconnect.com/search; jsessionid=7j7jnqjc1l2rj.victoria?title=");




arr[arr.length] = new Array("Library Literature (Library Science)", "http://ezproxy.twu.edu:2048/login?url=http://vnweb.hwwilsonweb.com/hww/jumpstart.jhtml? prod=LIBFT&query=");

arr[arr.length] = new Array("Oxford Reference Online", "http://ezproxy.twu.edu:2048/login?url=http://www.oxfordreference.com/views/SEARCH_RESULTS.html ?y=0&q=");

arr[arr.length] = new Array("Proquest (Social Sciences, Nursing)", "http://ezproxy.twu.edu:2048/login?url=http://proquest.umi.com/pqdweb ?RQT=305&querySyntax=PQ&searchInterface=1&clientId =15109&JSEnabled=1&SQ=");





arr[arr.length] = new Array("PubMed (Health Sciences, Medicine, Nursing)", "http://ezproxy.twu.edu:2048/login?url=http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi ?SUBMIT=y&db=PubMed&cmd=search&term=");

arr[arr.length] = new Array("SMART Imagebase (Medical Illustrations/Charts)", "http://ebsco.smartimagebase.com/chooseexhibit.php ?A=1189&I=1189&TL=1281&ExhibitKeywords=");

arr[arr.length] = new Array("Springerlink/Kluwer (All Subjects)", "http://ezproxy.twu.edu:2048/login?url=http://www.springerlink.com/content/ ?k=");

arr[arr.length] = new Array("Women and Social Movements: Scholar's Ed.", "http://ezproxy.twu.edu:2048/login?url=http://asp6new.alexanderstreet.com/wasm/wasm.results.movements.asp?word=");
// 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>

<SCRIPT language=JavaScript type=text/javascript>

<!--

<!-- Begin

function formHandler(form){

var URL = document.form.site.options[document.form.site.selectedIndex].value;

window.location.href = URL;

}



function expandDiv(tlll) {



what = eval(tlll + "_menu");



if (what.style.display == "none") {

what.style.display = "";

}

else

what.style.display = "none";

}



var oldc = new Array;

function cCell(r,m){

if(!document.all) return;

if(m){

for(i=0;i<r.cells.length;i++){

oldc[i]=r.cells[i].bgColor;

r.cells[i].bgColor='D3D3D3';

}

}else{

for(i=0;i<r.cells.length;i++){

r.cells[i].bgColor=oldc[i];

}

}

}

//

// 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];}

}

//-->

</SCRIPT>[/HTML]
Mar 29 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
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.