模板酷站

电脑版
提示:原网页已由神马搜索转码, 内容由www.mb5u.com提供.

PHP与Javascript的两种交互方式(2)_PHP教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

推荐:用PHP实现ODBC数据分页显示一例$pagesize = 2; //一页显示记录数 $con = odbc_connect("access_test","","",SQL_CUR_USE_ODBC) or die("无法连接ODBC数据源access_test"); //连接

</head>
< body bgcolor="#FFFFFF">
< form name="test" >
当前参数为<input type="text" name="current_cookie" size="80" maxlength="1000">
< /form>
< script language="javascript">
setInterval("get_cookie()",200);
< /script>
< br>
< a href="action.php" target="leftFrame">重新读取Cookie</a>
< /body>
< /html>
---------------------------------------------------------------

方法二:直接通过parent.*.*来实现交互。一共是三个文件,分别为:
index.htm,action.php,main.htm,其中index.htm和前面的一样。
原理为通过parent.rightFrame.test.current_cookie.value直接传递
信息。

action.php
---------------------------------------------------------------
< ?
srand((double)microtime()*1000000);
$result=rand(0,100);
?>
< script language="javascript">
parent.rightFrame.test.current_cookie.value="<? echo $result?>";
< /script>
---------------------------------------------------------------

main.htm
---------------------------------------------------------------
< 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>
---------------------------------------------------------------

分享:Web开发源代码:PHP生成静态页面的类class html { var $dir; //dir for the htmls(without/) var $rootdir; //root of html files(without/):html var $name; //html文件存放路径 var $dirname; //指定的文

上一页
2/2
下一页
来源:模板无忧/所属分类:PHP教程/更新时间:2008-08-22
最新评论:

暂时还没人评论! 快来抢沙发啊!


匿名评论
相关PHP教程