Help - Search - Members - Calendar
Full Version: Js help...
Invision Power Services > Community Forums > Community Web Design and Coding
abcdefzyxwvu
Im using dhtml/js to toggle viewing tables etc when clicking a link. Whenever you click the link, it stops images loading.. how can I prevent this???
abcdefzyxwvu
Bump sad.gif
Den-Den
Maybe you should post the code you're using. :yes:
abcdefzyxwvu
CODE
function togglepics(item)
{
    item = 'gallery_' + item;
    if (window.document.getElementById(item).style.display == "none")
    {
        window.document.getElementById(item).style.display = "block";
    }
    else
    {
        window.document.getElementById(item).style.display = "none";
    }
}


I tried using return true; but that didnt work... sad.gif
Dan C
The problem is this:

CODE
if (window.document.getElementById(item).style.display == "none")


blah.style.display == "none" won't contain a value at all (or at least, a null value) until it is first set using javascript. So if you want to use this, you are going to have to set all of the items as visible first, then your code will work. original.gif
Stephen
Or you could change that line to

CODE
if (window.document.getElementById(item).style.display != "block")
abcdefzyxwvu
the code does work it just stoppes the page loading any further when u click the link.. sad.gif
abcdefzyxwvu
bump shocked.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.