Problem with style.display = 'block';

User Help for Mozilla Firefox
Post Reply
shalinisweet
Posts: 3
Joined: August 29th, 2008, 6:12 am

Problem with style.display = 'block';

Post by shalinisweet »

Hello,

I have some proble with this script please help me

Here is java script code
######################
<script language="javascript">
function fun1()
{
document.all("table1").style.display = 'block';
document.all("table2").style.display = 'none';
document.all("table3").style.display = 'none';
document.all("table4").style.display = 'none';

}
function fun2()
{
document.all("table1").style.display = 'none';
document.all("table2").style.display = 'block';
document.all("table3").style.display = 'none';
document.all("table4").style.display = 'none';


}
function fun3()
{
document.all("table1").style.display = 'none';
document.all("table2").style.display = 'none';
document.all("table3").style.display = 'block';
document.all("table4").style.display = 'none';
}

function fun4()
{
document.all("table1").style.display = 'none';
document.all("table2").style.display = 'none';
document.all("table3").style.display = 'none';
document.all("table4").style.display = 'block';
}

</script>
######################

<table id="table2" style="display:none" width="769" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="76" align="center" bgcolor="#272727">&nbsp;</td>
<td width="610" align="center" bgcolor="#272727"><img src="images/hometext.gif" width="592" height="119" /></td>
<td width="83" align="center" bgcolor="#272727">&nbsp;</td>
</tr>
</table>

######################

for more detail please check the URL because i can not past all the code here

http://www.design4india.com/saks/

when you see it on IE it works fine

but in firefox its not working

Thanks

Shalini
User avatar
dickvl
Posts: 54163
Joined: July 18th, 2005, 3:25 am

Re: Problem with style.display = 'block';

Post by dickvl »

document.all doesn't work in Firefox. You can check the Tools > Error Console to verify that.

There is also an error about cross_marquee (there is no element #vmarquee)
Error: cross_marquee is null
Source File: http://www.design4india.com/saks/
Line: 89
Guest
Guest

Re: Problem with style.display = 'block';

Post by Guest »

Actually, document.all is silently supported but will return undefined if tested; sites that use it won't break. However, you should use document.getElementById('id').

In Firefox, the default value for display on tables is table, not block. Change style.display = 'block'; to style.display = ''; This will reset display to the default value for all browsers.
Guest
Guest

Re: Problem with style.display = 'block';

Post by Guest »

^ Perhaps something was changed in reference to document.all. At any rate, document.getElementById should be used instead.
shalinisweet
Posts: 3
Joined: August 29th, 2008, 6:12 am

Re: Problem with style.display = 'block';

Post by shalinisweet »

If document.all doesn't work in Firefox

then what i will use place of document.all because i don't know "document.getElementById('id')."
shalinisweet
Posts: 3
Joined: August 29th, 2008, 6:12 am

Re: Problem with style.display = 'block';

Post by shalinisweet »

Ok guys

Thanks a lot i have done it document.getElementById.

Shalini
Post Reply