Apr 08 28
Microsoft’s Internet Explorer never fails to amaze me – coding JavaScript and CSS for the IE is quite a challenge. The other day I tried to show/hide a table based on the value of a dropdown box.
function hideUnhideDateFields() {
var tarifScheme = document.getElementById("dropdownTarifscheme");
var dateTable = document.getElementById("dateTable");
if (tarifScheme && tarifScheme.value == "") {
dateTable.style.visibility = "collapse";
} else {
dateTable.style.visibility = "visible";
}
}
While this works flawlessly with browsers, the script crashes in IE: it complains about “Could not get the visibility property. Invalid argument.” Hey IE, talk to me, what is your problem?
I couldn’t get behind it and switched stratey, therefore.
function hideUnhideDateFields() {
var tarifScheme = document.getElementById("dropdownTarifscheme");
var dateTable = document.getElementById("dateTable");
if (tarifScheme && tarifScheme.value == "") {
dateTable.style.display = "none";
} else {
dateTable.style.display = "";
}
}
February 23rd, 2009 at 0:18
Ran into this very same problem whilst coding my own collapsin menu system. Have had to write two separate sets of code, one for IE and one for non-IE… Not yet got it to work fully, everytime I refresh the page and see it failing in IE it reminds me of one of the reasons why I left this awful browser behind and can’t understand why others swear by it…
August 5th, 2009 at 11:14
i came across this problem. but it was solved.
u have to write the code:
dateTable.style.display = ‘ ‘;
only in single quotes not double quotes.
this change when applies to my code works in all browsers