Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE6 dhtml javascript error.... 2

Status
Not open for further replies.

theEclipse

Programmer
Joined
Dec 27, 1999
Messages
1,190
Location
US
I would appreciate any help anybody can provide me to debug this code. I cant seem to find anything on google when I search for the error, except for some other people having the same problem (however no fix is provided). Of course it works perfectly in FF, but fails completely in IE.

The goal is to do show/hide a table cell using the display property. The error I get is:
Code:
Could not get the display property. Invalid argument.

My Javascript function. The line highlited in red is the one IE points to as broken, and it indeed doesnt error if I comment it out. (I added the try/catch to try and keep IE from blowing up....)
Code:
function toggleId(id){
	try {
		var elem = document.getElementById(id);
		if (elem.style.display != 'table-cell'){
			[COLOR=red]elem.style.display = 'table-cell';[/color]
		} else {
			elem.style.display = 'none';
		}
	} catch (e) {//fail gracefully
		str = "";
		for (i in e)
			str += e[i] + "\\n";
		alert(str);
		alert(elem.style.display);
	}
}

And lastly, the place that the code is called:
Code:
	<td class="rowOdd">
		<a href="" onclick="toggleId('row_f'); return false;">Edit</a><br />
	</td>
	</tr>	<tr>
		<td colspan="5"  id="row_f" style="display:none;">
		<form name="edit_f" method="POST" action="">
		...
		</form>
		</td>
	</tr>

If you want to see the code in action, check out this work-in-progress:
There is a server auth. for now: un:[tt]dev[/tt] pw:[tt]!@#$[/tt]
login on the left with [tt]ttuser@nowher.net[/tt] pw:[tt]2468[/tt]

Thanks!

Robert Carpenter
Remember....eternity is much longer than this ~80 years we will spend roaming this earth.
ô¿ô
 
bah! That is about the most annoying thing ever.

I guess I'll have to re write the entire website (sarcastic wimper....)

Thanks

Robert Carpenter
Remember....eternity is much longer than this ~80 years we will spend roaming this earth.
ô¿ô
 
Not so. You can still keep your table cells for browsers that support them, and still get IE working with some neat CSS tricks:

1. Make sure your document is in "quirks mode" by placing a comment on the line before your DOCTYPE (or simply removing your DOCTYPE altogether, but I wouldn't recommend this).

2. For IE only, ,you can them use floats, and heights of 100% to emulate table cells and rows.

I used this quite successfully a few weeks back when working on the new O2 website.

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top