寻找事件触发器 [英] Looking for an event trigger

查看:122
本文介绍了寻找事件触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在页面完全完成后执行一些代码

loading"我的意思是页面和它上面的所有图像,有没有人

知道如何做到这一点?

解决方案

Clever...@hotmail.com napisal(a):


我希望执行一些代码当页面有完全完成

loading"我的意思是页面和它上面的所有图像,有没有人

知道这样做的方法?



您可以使用AJAX来完成。将一些java脚本代码放入页面,

将在加载页面时向您的服务器发出请求,以通知PHP

脚本,整个页面已被加载。 />


Cl*******@hotmail.com aécrit:


我希望执行一些代码当页面完全完成时

loading"我的意思是页面和它上面的所有图像,有没有人

知道这样做的方法?



< script type =" text / javascript">


function sthg(){

document.body.style.background =''orange'';

}


onload = function(){sthg();警报(''全部加载''); };

< / script>

在加载所有图像之前会发出警告吗?


Cl ******* @ hotmail.com 写道:


我希望执行一些代码当页面完全完成

loading时我的意思是页面和它上面的所有图像,是否有人

知道如何做到这一点?



你在看吗在服务器或客户端上执行一些代码?什么

你真的想要做什么?


记住 - PHP只是服务器端。它与

客户没有直接联系。它所知道的是它将数据传递给网络服务器

以便发送给客户端。它不知道之后发生了什么 -

即使浏览器关闭或连接在

页面完成加载之前就没有了。


您可以在客户端使用Javascript进行操作,并且正如Mateusz所示,

可以使用AJAX在服务器上调用函数。


-

==================

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================


I''m hoping to execute some code "when the page has completely finished
loading" by which I mean the page and all the images on it, does anyone
know of a way to do this?

解决方案

Clever...@hotmail.com napisal(a):

I''m hoping to execute some code "when the page has completely finished
loading" by which I mean the page and all the images on it, does anyone
know of a way to do this?

You can do it using AJAX. Put some java script code into page which
will make a request to your server when page is loaded to inform PHP
script that whole page''s been loaded.


Cl*******@hotmail.com a écrit :

I''m hoping to execute some code "when the page has completely finished
loading" by which I mean the page and all the images on it, does anyone
know of a way to do this?

<script type="text/javascript">

function sthg() {
document.body.style.background=''orange'';
}

onload = function() { sthg(); alert(''all loaded''); };
</script>
does alert fires before all images loaded ?


Cl*******@hotmail.com wrote:

I''m hoping to execute some code "when the page has completely finished
loading" by which I mean the page and all the images on it, does anyone
know of a way to do this?

Are you looking to execute some code on the server or the client? What
are you actually trying to do?

Remember - PHP is server side only. It has no direct contact with the
client. All it knows is when it''s passed its data off to the web server
for sending to the client. It doesn''t know what happens after that -
not even if the browser is closed or the connection dropped before the
page completed loading.

You can do it in Javascript on the client, and as Mateusz indicated you
can use AJAX to call a function back on the server.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


这篇关于寻找事件触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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