源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

php后台程序与Javascript的两种交互方式

  • 时间:2020-10-05 19:21 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:php后台程序与Javascript的两种交互方式
方法一:通过Cookie交互。 一共是三个文件,分别为:index.htm,action.php,main.htm 原理为前台页面main.htm和后台action.php通过页面框架 index.htm组织起来,将action.php的页面宽度设为0,这样并不影响显示。action.php将信息放入cookie中,main.htm通过读取 cookie来实现交互。在main.htm中也可以通过重新读取action.php 来实现控制后台CGI程序。 index.htm
[url=action.php]</body> </html>
方法二:直接通过parent.*.*来实现交互。 一共是三个文件,分别为:index.htm,action.php,main.htm,其中index.htm和前面的一样。 原理为通过parent.rightFrame.test.current_cookie.value直接传递信息。 action.php main.htm
[u]复制代码[/u] 代码如下:
<html> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body bgcolor="#FFFFFF"> <form name="test" > 当前参数为<input type="text" name="current_cookie" size="80" maxlength="1000"> </form> <br> <a href="action.php" target="leftFrame">重新读取Cookie</a> </body> </html>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部