View Full Version : javascript does not find element run when page loads

06-18-2010, 07:17 PM
Hi. I am very new to javascript, so I might not even be wording my question right, but I am going to try and be as concise and specific as possible.

I am using jquery on my website- the galleria plugin- to make a slideshow. you can see the completed show here:

This slideshow will be one of three on my website. Each slide show will opperate the same exact way.I have built in tabbed navifation, and the slideshows will all be accessable under the "portfolio" tab by clicking on their corresponding links.

check out the site here:

As it is I have one slideshow up, although not yet connected to the corresponding link, but the images won't load. My guess is that because the div tag is hidden that the contents don't load propperly and I need the contents to load when the corresponding div tag that it is contained in becomes visible but I don't know how to do that.

this is the javascript that I have written to show/hide the <div> tags where the content will live. Three slide shows will live in content_2 and show/hide when the corresponding button is pressed.

function tabSwitch(new_tab, new_content) {

document.getElementById('content_1').style.display = 'none';
document.getElementById('content_2').style.display = 'none';
document.getElementById('content_3').style.display = 'none';
document.getElementById('content_4').style.display = 'none';
document.getElementById(new_content).style.display = 'block';

document.getElementById('btn_1').className = '';
document.getElementById('btn_2').className = '';
document.getElementById('btn_3').className = '';
document.getElementById('btn_4').className = '';
document.getElementById(new_tab).className = 'current';


thank you- I am really stuck. i promise, i am actually learning javascript, I'm not just trying to get other people to do my work for me.