Urgent! JavaScript problems
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Javier_Martinez
Posted On:   Wednesday, February 20, 2002 02:53 AM

I am trying to hide and show blocks when the user clicks on the links. Is like a Folder Tree. I have one version working fine with IE but I have some problems with Netscape. The problem is that when I click it doesn't do anything. I don't know why. I enclose you the Javascript function and the HTML code. Thank you very much var icons = new Array(12); function preload() { if(document.images) { icons[0] = new Image(16,13) icons[0].src = "/images/closed.gif" icons[1] = new Image(16,13) icons[1].src = "/images/open.gif" icons[2] = new Image(); icons[2].src = "/images/green_c.gif"; icons[3   More>>


I am trying to hide and show blocks when the user clicks on the links. Is like a Folder Tree. I have one version working fine with IE but I have some problems with Netscape.

The problem is that when I click it doesn't do anything. I don't know why.
I enclose you the Javascript function and the HTML code.

Thank you very much

			
var icons = new Array(12);
function preload()
{
if(document.images)
{
icons[0] = new Image(16,13)
icons[0].src = "/images/closed.gif"
icons[1] = new Image(16,13)
icons[1].src = "/images/open.gif"
icons[2] = new Image();
icons[2].src = "/images/green_c.gif";
icons[3] = new Image();
icons[3].src = "/images/green_o.gif";
icons[4] = new Image();
icons[4].src = "/images/blue_c.gif";
icons[5] = new Image();
icons[5].src = "/images/blue_o.gif";
icons[6] = new Image();
icons[6].src = "/images/yellow_c.gif";
icons[7] = new Image();
icons[7].src = "/images/yellow_o.gif";
icons[8] = new Image();
icons[8].src = "/images/red_c.gif";
icons[9] = new Image();
icons[9].src = "/images/red_o.gif";
icons[10] = new Image();
icons[10].src = "/images/gray_c.gif";
icons[11] = new Image();
icons[11].src = "/images/gray_o.gif";
}
}

function showhide(what,what2,i)
{
if (document.getElementById(what).style.display == "none")
{
document.getElementById(what).style.display = "block";
document.getElementById(what2).src=icons[i+1].src;
}
else
{
document.getElementById(what).style.display = "none";
document.getElementById(what2).src=icons[i].src;
}
}


And the HTML


			



   <<Less

Re: Urgent! JavaScript problems

Posted By:   Benoit_Quintin  
Posted On:   Wednesday, February 20, 2002 06:03 AM

My friend, you are using
tags, and Netscape doesn't know about div tags, as far as I can tell... Go to this site for more info. Or buy yourself a book on JavaScript and HTML...
About | Sitemap | Contact