Spadar Programmer wrote:
> <div id="some_div">
> ...
> <script type="text/javascript">
> var oParentTag = getParentTag('some_div');
> </script>
> ...
> </div>
>
> And my question: is there anything way to get the parent tag without
> passing argument to the function in this case? Can JavaScript
> atomatically determine the placement tag for executed script?
If the script is global code then it is being executed while the page is
loaded and parsed meaning in that case
var divs = document.getElementsByTagName('div');
var lastDiv = divs[divs.length - 1];
should give you the div preceding the script element.
--
Martin Honnen
http://JavaScript.FAQTs.com/