Show/hide table

M

Mateo

Hi!

I have a litle JS problem.... I'm trying to make show/hide table JS
function, but my show/hide table
function works only on IE.... It works in mozilla partially. Actually,every
time when I contract table the empty
field is left.

You can see example in left side menu on www.kijevo.hr when you click on
plus or minus. If you
access page from mozilla you will se the problem... From IE it works just
fine...


For show/hide efect I used style.display = 'block'; and style.display =
'none';
(I didn't actually wrote function, I adapted it)

Here is code:
function showtrPV( row) {

var strTable = 'tblUslugaSH';

var strIMG = 'imgSH';

if (document.getElementById(strTable).rows[1].style.display == 'none') {

document.getElementById(strIMG).src = 'Pictures/minus.gif';

document.getElementById(strTable).rows[1].style.display = 'block';

eval("lblRoomTypeCrta" + nRedniBrojUsluge + ".style.visibility =
'hidden'" + ";");

}

else {

document.getElementById(strIMG).src = 'Pictures/plus.gif';

document.getElementById(strTable).rows[1].style.display = 'none';

eval("lblRoomTypeCrta" + nRedniBrojUsluge + ".style.visibility = ''"
+ ";");

}

}




Thanks!
 
D

David Dorward

Mateo said:
I have a litle JS problem.... I'm trying to make show/hide table JS
function, but my show/hide table function works only on IE

As of CSS 2, table rows default to "display: table-row". If you set them to
"display: block" then they won't act like table rows any more.

Toggle the style.display property between "none" and "" instead of "none"
and "block".
 
M

Mateo

Thx man!

U solved my problem! U Rock!

Mateo P.

David Dorward said:
As of CSS 2, table rows default to "display: table-row". If you set them to
"display: block" then they won't act like table rows any more.

Toggle the style.display property between "none" and "" instead of "none"
and "block".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top