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.disp
lay="block";
document.getElementById("H1121").style.display=&qu
ot;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
___________________________________________________
This message is from the kde-linux mailing list.
Account management: http
s://mail.kde.org/mailman/listinfo/kde-linux.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.h
tml.
|