IE没有做“onload”功能? [英] IE no doing "onload" function?

查看:110
本文介绍了IE没有做“onload”功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有服务器端脚本,我一直这样做是为了最后

修改我的网页上的标签:


< div class =" modified">

< script type =" Text / JavaScript">

<! -

document.write("此页面最后被修改:" +

document.lastModified);

- >

< / script>

< / div>


足够,但据说最好分开内容和

代码。


所以在一个单独的js文件中我这样做了:
< br $>
window.onload = last_modified;


函数last_modifed()

{

var obj = document .getElementById(" modified");

obj.innerHTML ="此页面最后被修改:" +

document.lastModified;

}


在我的文档中使用此html:


< div id =" modified" class =" modified">& nbsp;< / div>


它在我的IE(6)中不起作用,但在Firefox中工作正常。任何

建议?

Not having server side scripting, I''ve been doing this for "last
modified" tags on my pages:

<div class="modified">
<script type="Text/JavaScript">
<!--
document.write("This page was last modified: " +
document.lastModified);
-->
</script>
</div>

It suffices, but supposedly it''s better to separate content and the
code.

So in a separate js file I did this:

window.onload = last_modified;

function last_modifed()
{
var obj = document.getElementById("modified");
obj.innerHTML = "This page was last modified: " +
document.lastModified;
}

With this html in my documents:

<div id="modified" class="modified">&nbsp;</div>

It does''t work in my IE (6), but works fine in Firefox. Any
suggestions?

推荐答案


fr ******* @ gmail.com 写道:
所以在一个单独的js文件中我这样做了:

window.onload = last_modified;

函数last_modifed()
{var /> var obj = document.getElementById(" modified");
obj .innerHTML ="此页面最后被修改:" +
document.lastModified;
}

在我的文档中使用此HTML:

< div id =" modified" class =" modified">& nbsp;< / div>

它在我的IE(6)中不起作用,但在Firefox中运行正常。任何
建议?
So in a separate js file I did this:

window.onload = last_modified;

function last_modifed()
{
var obj = document.getElementById("modified");
obj.innerHTML = "This page was last modified: " +
document.lastModified;
}

With this html in my documents:

<div id="modified" class="modified">&nbsp;</div>

It does''t work in my IE (6), but works fine in Firefox. Any
suggestions?






window.onload = last_modified;


在函数声明之后(在脚本结束时)。



Put
window.onload = last_modified;

after the function declaration (at the end of your script).


VK写道:
fr ******* @ gmail.com 写道:



< snip>


<snip>

它在我的IE(6)中不起作用,但在Firefox中工作正常。有什么建议吗?
It does''t work in my IE (6), but works fine in
Firefox. Any suggestions?




window.onload = last_modified;

在函数声明后(在
脚本的末尾) 。



Put
window.onload = last_modified;

after the function declaration (at the end of your
script).




自从接受在变量实例化过程中接受

变量声明后,甚至连几天都没有,

在执行执行上下文的任何实际代码之前。你

甚至声称已经阅读了规范。然而你没有看到,或者b
不明白,功能声明也是如此。


分配的位置在全局执行上下文中对已声明的全局

函数的引用无关紧要,因为

函数将在执行任何实际的
$之前创建。 b $ b代码。


如果你自己无法真正理解javascript你

真的不应该打扰其他人你弄错了你的错误/>
了解javascript。


Richard。



It is not even a couple of days since were beaten into accepting that
variable declarations are acted upon during variable instantiation,
prior to the execution of any actual code for the execution context. You
even claimed to have read the specification. Yet you didn''t see, or
didn''t understand, that the same is true of function declarations.

The location of an assignment of a reference to a declared global
function in the global execution context does not matter because the
function will have been created prior to the execution of any actual
code.

If you are not capable of actually comprehending javascript yourself you
really should not bother other people with the nonsense that you mistake
for an understanding of javascript.

Richard.


function last_modifed()



window.onload = last_modified;


你修改了一个拼写错误。

function last_modifed()
but
window.onload = last_modified;

you have a typo in modified.


这篇关于IE没有做“onload”功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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