link element onload

前端 未结 11 845
予麋鹿
予麋鹿 2020-11-30 03:31

Is there anyway to listen to the onload event for a element?

F.ex:

var link = document.createElement(\'link\');
link.rel =          


        
11条回答
  •  再見小時候
    2020-11-30 04:26

    This is kind of a hack, but if you can edit the CSS, you could add a special style (with no visible effect) that you can listen for using the technique in this post: http://www.west-wind.com/weblog/posts/478985.aspx

    You would need an element in the page that has a class or an id that the CSS will affect. When your code detects that its style has changed, the CSS has been loaded.

    A hack, as I said :)

提交回复
热议问题