[Javascript] document.getElementById has no properties

Julien Nadeau junado at junado.com
Tue Sep 20 16:14:24 CDT 2005


It's hard to get an idea of what's going wrong without a live  
example, but I can think of two things:

1) Your $Back_Link PHP variable could contain faulty characters (I'm  
thinking about \, ', "... theses chars, if not escaped, would wreck  
havoc on your "rendered" source).
or 2) If your PHP is configured with register_globals = off,  
$Language_Id should be called as $_GET['Language_id'] (turning off  
register_globals is a good thing, too).

If this is not the problem, I would suggest you start debugging by  
changing the appendChild statement to try and append a textNode to  
your <a> tag, just to see if this works. If it does, then you know  
that you have to narrow your debugging to your top.bottombar[1][<?= 
$Language_ID?>] part.

Something like this:

<script type="text/javascript">
     var text = document.createTextNode("This works!");
     document.getElementById("bottomback").appendChild(text);
</script>

Julien Nadeau
junado at junado.com

Le 05-09-20 à 06:04, Vinayakam Murugan a écrit :

> 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>
>
> ------------------------------------------
>
> Any ideas, I have googled but it didn't help much.
>
> -- 
> Warm Regards
> ~~~~~~~~~~~~~~~
> Vinayak
> http://theregoesanotherday.blogspot.com/
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20050920/33383f97/attachment.htm>


More information about the Javascript mailing list