从php调用javascript警报 [英] calling a javascript alert from php

查看:59
本文介绍了从php调用javascript警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我希望能够在php中触发javascript风格的弹出式提醒

(我想在实际页面上显示一条消息)这可能吗?

解决方案

monomaniac21写道:


嗨我希望能够在php中触发javascript风格的弹出警报

(我想要的实际网页上显示的消息)这可能吗?



I''ll借此一个...我通常在这里做的就是提问。


你的问题的答案是否定的。在..... / *
之前,PHP运行在*服务器上页面显示。因此,Php无法弹出像JavaScript这样的警报

(在页面加载后在*客户端计算机上运行)。


那说;如果您想实施两步程序,例如


(1)删除此文件。

(2)您确定(是或否)?


您可以使用Php执行此操作,但是单击(1)必须创建一个请求,以便服务器显示一个新页面(2)作为形式或超链接。

点击Y或N必须再次返回服务器才能执行

操作。


-

*****************************

Chuck Anderson?博尔德,CO
http://www.CycleTourist.com

每个人的旅程应该是不同的,

这样我们所有人都会以新的和无尽的方式丰富



** *******************************


Chuck Anderson写道:


monomaniac21写道:


>嗨我希望能够在php中触发javascript风格的弹出警报
(我希望在实际页面上显示一条消息)这可能吗?



我会拿这个...我通常都是这里是问问题。


您的问题的答案是否。在显示

页面之前,Php在*服务器上运行。因此,Php无法弹出像JavaScript这样的警报

(在页面加载后在*客户端计算机上运行)。


那说;如果您想实施两步程序,例如


(1)删除此文件。

(2)您确定(是或否)?


您可以使用Php执行此操作,但是单击(1)必须创建一个请求,以便服务器显示一个新页面(2)作为表单或超链接。

点击Y或N必须再次返回服务器才能执行

操作。



,也可以有PHP吐出JavaScript作为网页和

触发它的onclick的一部分=在提交。


-david-


David Haynes写道:


Chuck Anderson写道:


> monomaniac21写道:


>>嗨我希望能够触发javascript风格的弹出警报在php
(我希望在实际页面上显示一条消息)这可能吗?

我会选择这个...我通常在这里做的就是提问。

你的问题的答案是否定的.Php在*服务器之前运行*显示
页面。因此,Php无法弹出类似JavaScript的警报
(在页面加载后在*客户端计算机上运行)。

如果你想实施一个两步程序,如

(1)删除这个文件。
(2)你确定(是或否)?

你可以用Php做到这一点,但是点击(1)必须创建一个请求,要求服务器显示带有(2)作为表单或超链接的新页面。
点击Y或N必须返回到再次能够/>动作进行


,也可以有PHP吐出JavaScript作为网页的一部分,

从提交中的onclick =触发它。


-david-



但是那个'不是'在Php中触发并且只是JavaScript。


-

*********************** ******

Chuck Anderson? Boulder,CO
http://www.CycleTourist.com

每个人的旅程应该是不同的,

这样我们所有人都会以新的和无尽的方式丰富



** ***************************


hi i want to be able to trigger a javascript style popup alert in php
(i want a message displayed on the actual page) is this possible?

解决方案

monomaniac21 wrote:

hi i want to be able to trigger a javascript style popup alert in php
(i want a message displayed on the actual page) is this possible?

I''ll take this one ... all I usually do here is ask questions.

The answer to your question is No. Php is run on the *server before* the
page is displayed. Therefore, Php cannot popup an alert like JavaScript
(which runs on the *client computer after* the page is loaded).

That said; if you want to implement a two step procedure like

(1) Delete this file.
(2) Are you Sure (Y or N)?

You can do that with Php, but clicking on (1) must create a request to
the server to display a new page with (2) as a form or hyperlinks.
Clicking on Y or N must return to the server again in able to perform
the action.

--
*****************************
Chuck Anderson ? Boulder, CO
http://www.CycleTourist.com
Everyone''s journey should be different,
so that we all are enriched
in new and endless ways
*****************************


Chuck Anderson wrote:

monomaniac21 wrote:

>hi i want to be able to trigger a javascript style popup alert in php
(i want a message displayed on the actual page) is this possible?

I''ll take this one ... all I usually do here is ask questions.

The answer to your question is No. Php is run on the *server before* the
page is displayed. Therefore, Php cannot popup an alert like JavaScript
(which runs on the *client computer after* the page is loaded).

That said; if you want to implement a two step procedure like

(1) Delete this file.
(2) Are you Sure (Y or N)?

You can do that with Php, but clicking on (1) must create a request to
the server to display a new page with (2) as a form or hyperlinks.
Clicking on Y or N must return to the server again in able to perform
the action.

or you can have the php spit out the javascript as part of the page and
trigger it from the onclick= in the submit.

-david-


David Haynes wrote:

Chuck Anderson wrote:

>monomaniac21 wrote:

>>hi i want to be able to trigger a javascript style popup alert in php
(i want a message displayed on the actual page) is this possible?

I''ll take this one ... all I usually do here is ask questions.

The answer to your question is No. Php is run on the *server before* the
page is displayed. Therefore, Php cannot popup an alert like JavaScript
(which runs on the *client computer after* the page is loaded).

That said; if you want to implement a two step procedure like

(1) Delete this file.
(2) Are you Sure (Y or N)?

You can do that with Php, but clicking on (1) must create a request to
the server to display a new page with (2) as a form or hyperlinks.
Clicking on Y or N must return to the server again in able to perform
the action.

or you can have the php spit out the javascript as part of the page and
trigger it from the onclick= in the submit.

-david-

But that''s not "triggered in Php" and is simply JavaScript.

--
*****************************
Chuck Anderson ? Boulder, CO
http://www.CycleTourist.com
Everyone''s journey should be different,
so that we all are enriched
in new and endless ways
*****************************


这篇关于从php调用javascript警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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