Safari中的onload [英] onload in Safari

查看:365
本文介绍了Safari中的onload的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想如果我有:


....

< body onload =" some_script();"> < br $> b $ b ....


在< body>之前不会调用some_script完全是

加载 - 这不是这种情况吗?使用Safari 1.3,我似乎不得不在some_script中延迟

(在< body>中有一些php会减慢

的加载速度)。由于我的< body>中碰巧有一个备用iframe,我在其中加载了一个

的一小部分html,其工作只是设置一个加载的。标志,

在我的延迟代码中测试。


我观察到的是< form>中的一些字段。在< body>,

,其值由some_script设置,在Safari中,不可见

直到我点击其中一个 - 然后它们全部弹出视线。我没有看到这个与其他浏览器和延迟机制修复它。


就好像onload一旦触发就被触发了遇到了

而不是加载完成时。


- 时间

I thought that if I have:

....
<body onload="some_script();">
....

that some_script would not be called until the <body> was completely
loaded - is this not the case? With Safari 1.3 I seem to have to delay
inside some_script (there is some php in the <body> that slows down the
loading). Since I happen to have a spare iframe in my <body>, I load a
tiny bit of html in it whose job is simply to set a "loaded" flag,
tested inside my delay code.

What I was observing was that some fields inside a <form> in the <body>,
whose values are set by some_script, were, with Safari, not visible
until I clicked in one of them - then they all popped into sight. I
wasn''t seeing this with other browsers and a delay mechanism fixed it.

It was as if the onload was triggered as soon as it was encountered
rather than when the loading was complete.

-- tim

推荐答案

Tim Streater写道:
Tim Streater wrote:
我似乎要在some_script内部延迟
I seem to have to delay inside some_script




为什么不把它放在<脚本>在页面的末尾< / body>?



Why not rather put the <script> at the end of the page after </body>?


bmgz写道:
Tim Streater写道:
Tim Streater wrote:
我似乎要在some_script内部延迟
I seem to have to delay inside some_script



为什么不把< script>放进去在< / body>之后的页面末尾?


Why not rather put the <script> at the end of the page after </body>?




< script>允许内部元素< head>元素和< body>元素,

但不在他们之外。


-

David Dorward< http://blog.dorward.me .UK /> < http://dorward.me.uk/>

Home是〜/ .bashrc的位置



<script> elements are allowed inside <head> elements and <body> elements,
but not outside them.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


David Dorward写道:
David Dorward wrote:
bmgz写道:
bmgz wrote:
Tim Streater写道:
Tim Streater wrote:





我似乎要在some_script内部延迟
I seem to have to delay inside some_script





为什么不把< script>在< / body>之后的页面末尾?
Why not rather put the <script> at the end of the page after </body>?



< script>允许内部元素< head>元素和< body>元素,
但不在他们之外。


<script> elements are allowed inside <head> elements and <body> elements,
but not outside them.



呐喊,

为什么不把< script>在页面的末尾BEFORE< / body>?


whoops,
Why not rather put the <script> at the end of the page BEFORE </body>?


这篇关于Safari中的onload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆