开发者

Javascript DOM ready without an entire framework

开发者 https://www.devze.com 2022-12-28 17:58 出处:网络
Does anyone know of a good javascript DOM ready library that I can use without loading an entire fr开发者_运维百科amework?I found one on google code that seems to work, but the library was posted in 2

Does anyone know of a good javascript DOM ready library that I can use without loading an entire fr开发者_运维百科amework? I found one on google code that seems to work, but the library was posted in 2008 and I can't find any confirmation on up-to-date cross browser support.


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.


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>


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.


Use ded's domready


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号