[Javascript] document.getElementById has no properties

Triche Osborne wdlists at triche-osborne.com
Tue Sep 20 09:51:17 CDT 2005


Vinayakam Murugan wrote:
> Hi
> 
> I am trying to append a preloaded image to a tag. It is giving me the 
> following error
> 
> Error: document.getElementById("bottomback") has no properties
> Source File: 
> http://192.168.100.11/app_dir/layout/preload.php?Language_Id=01&Class_Id=first
> Line: 63
> 
> ------------------------------------------
> <a id="bottomback" name="bottomback" class="back" href="<?echo 
> $Back_Link?>;showmouse();"></a>
> 
> <script type="text/javascript">
> document.getElementById("bottomback").appendChild(top.bottombar
> [1][<?=$Language_Id?>]);
> </script>
> 
I tested this twice, once with a child SPAN I made up and once with your 
URL query but without (obviously) your image array.

The first test looked like this:
document.getElementById("bottomback").appendChild(newSpan);

It successfully attaches the span to bottomback.

The second test worked as I expected, returning the error message 
"top.bottombar has no properties". It writes out the following script 
source code:
document.getElementById("bottomback").appendChild(top.bottombar[1][01]);

Neither of these tests refuses to recognize bottomback itself. (Though 
unless your PHP is printing more than just a URL there, that showmouse() 
function is out of place.)

Since the SPAN attached just fine, recheck the code that you're using to 
create the top.bottombar array to be sure there's something there. Also, 
be sure that you are recognizing 01 in the second dimension, not just 1.

Triche




More information about the Javascript mailing list