Javascript DOM ready without an entire framework

后端 未结 6 948
滥情空心
滥情空心 2020-12-14 08:57

Does anyone know of a good javascript DOM ready library that I can use without loading an entire framework? I found one on google code that seems to work, but the library w

相关标签:
6条回答
  • 2020-12-14 09:26

    Just do this right before the closing body tag:

    <html>
    <script>
    function runAfterLoad() {
    }
    ... lots of stuff
    </script>
    <body>
    
    ... lots of stuff
    
    <script>runAfterLoad();</script></body>
    </html>
    
    0 讨论(0)
  • 2020-12-14 09:33

    It seems that the safest bet is indeed to use a javascript framework. I was able to find some small DOMready libraries - but nothing written recently or claiming to be confirmed working with the most current browser releases.

    0 讨论(0)
  • 2020-12-14 09:37

    Checkout Dean Edwards' base2. It contains a minimal amount of code necessary to patch up browser differences and provide nice consistent interface as per the standards. The gzipped version is only 6k.

    0 讨论(0)
  • 2020-12-14 09:38

    Use ded's domready

    0 讨论(0)
  • 2020-12-14 09:42

    please check out this simple function dom ready function

    it has been tested in ie 8 , firefox, chrome and safari .

    and check this answer javascript domready?

    0 讨论(0)
  • 2020-12-14 09:45

    David Mark's "My Library" has a "DOM ready" functionality:

    http://www.cinsoft.net/mylib.html

    David is avid anti-framework, anti-bad-javascript-practice so it should be good quality code.

    0 讨论(0)
提交回复
热议问题