javascript - Need to detect which <script> block interact with which other <script> block in a webpage? -
i need check whether javascript in 1 block, can access or manipulate javascript in script block in webpage. example, second block (inside div) access first script block inside body.
<body> <script> var first_script_block=0; </script> <div> <script > var secondblock_acess_first =first_script_block; </script> </div> </body> i though lot. feel horrible. need ideas. :(
all scripts share same global-object
if don't want happen(it's hard tell question) use closures:
<script> (function (){ // here code first script tag. })(); </script> ... <script> (function (){ // here code second script tag })(); </script>
Comments
Post a Comment