[kde-linux] Javascript statement: visible=(obj.style.display=="block"); problem in Konqueror 3.4.2
Randy Kramer
rhkramer at gmail.com
Mon Jul 9 18:06:51 UTC 2007
I'm having trouble with a javascript program I've copied out of a book (to
continue my experimentation/learning). The program works fine in opera, but
gives me a "Type Error -- Null Value" at the following line (in Konqueror
3.4.2):
visible=(obj.style.display=="block");
(In the book that I copied the program from, it didn't have the trailing
semicolon, but I added that and have tried it both ways.)
The lines preceding that line are:
function Toggle(e) {
if (!document.getElementById) return;
if (!e) var e = window.event;
whichlink = (e.target) ? e.target.id : e.srcElement.id;
obj=document.getElementById(whichlink+"menu");
visible=(obj.style.display=="block");
I've done a little experimenting, trying things like:
obj.style.display="block";
obj.style.display="inline";
obj.style.display="none";
obj.style.display="0";
...but all with the same error and message.
In another trial program (which I wrote myself), I used statements like the
following with no problem:
<span id="H11" !--onclick show spans L1 and H2--
onclick='document.getElementById("L11").style.display="block";
document.getElementById("H1121").style.display="block"'>
So, then I tried a statement like the following, but ended up with the same
"Type Error -- Null Value":
visible=(document.getElementById(whichlink+"menu").style.display=="block");
Randy Kramer
More information about the kde-linux
mailing list