Chrome - < body onload ="">不管用 [英] Chrome - <body onload=""> is not working
问题描述
我知道
当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 - < body onload ="">不管用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!