Chrome - < body onload ="">不管用 [英] Chrome - <body onload=""> is not working

查看:235
本文介绍了Chrome - < body onload ="">不管用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道


当DOM完全加载时,Onload会执行。这意味着它会在
结束页面后执行。当你想要在
文件被完全借出时执行某项任务时,这很有用。

"Onload executes when DOM fully loaded.This means it is executed after end of your page. This is useful when you want to do some task when document is fully loaed."

但为什么这些代码不要在chrome中工作(spBodyOnLoadWrapper是在init.debug.js中定义的函数,此函数未被调用):

but why these code don't work in chrome(spBodyOnLoadWrapper is a function defined in "init.debug.js" , this function was not called ):

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns:o="urn:schemas-microsoft-com:office:office" lang="en-us" dir="ltr">
    <head>
   <script type="text/javascript">
    document.write('<script type="text/javascript" src="/_layouts/1033/init.debug.js?rev=Cn3X2qRiBI8U52EFeStGwg%3D%3D"></' + 'script>');
     </script>
    </head> 
    <body scroll="no" onload="if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();" class="v4master">
    </body>

这些HTML是由名为SharePoint 2010的Microsoft产品生成的,丑陋而非最佳实践 ,但我必须让它在chrome中工作...

These HTML is generated by a Microsoft product named "SharePoint 2010", ugly, and not "best practices" , but i have to make it work in chrome...

推荐答案

document.write() 是JavaScript代码,因此必须包含在脚本元素中。

document.write() is JavaScript code, so it must be included within a script element.

这篇关于Chrome - &lt; body onload =&quot;&quot;&gt;不管用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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