How to make the front-end page and
Maintaining interaction between CGI pages in the background is always a problem. Here we will introduce two
.
Method 1: use cookies for interaction. There are three files in total:
Index.htm,action.php, main.htm
It turns out that the front page main.htm and the background action. php use the page framework
Index.htm is organized to set the page width of action. php to 0.
Impact display. Action.php puts the information into cookie, and main.htm reads the information
Cookie. In main.htm, you can also re-read action. php
To control the background CGIProgram.
Index.htm
---------------------------------------------------------------
<HTML>
<Head>
<Title> test </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
</Head>
<Frameset framespacing = "0" border = "false" frameborder = "0" Cols = "0, *">
<Frame name = "leftframe" scrolling = "no" noresize src = "Action. php">
<Frame name = "rightframe" scrolling = "Auto" src = "main.htm">
</Frameset> <noframes>
<Body bgcolor = "# ffffff">
<P> This page uses the page framework, but your browser does not support it. </P>
</Body>
</Noframes>
</Html>
---------------------------------------------------------------
Action. php
---------------------------------------------------------------
<?
Srand (double) microtime () * 1000000 );
$ Result = revert (0,100 );
Setcookie ("action", $ result, time () + 900 ,"/");
?>
---------------------------------------------------------------
main.htm
latency
test
the current parameter is
re-read cookie
-------------------------------------------------
Method 2: directly implement interaction through parent. There are three files in total:
Index.htm,action.php, main.htm,index.htm is the same as the previous one.
The principle is to directly pass through parent. rightframe. Test. current_cookie.value.
Information.
Action. php
---------------------------------------------------------------
<?
Srand (double) microtime () * 1000000 );
$ Result = revert (0,100 );
?>
<Script language = "JavaScript">
Parent. rightframe. Test. current_cookie.value = "<? Echo $ result?> ";
</SCRIPT>
---------------------------------------------------------------
main.htm
latency
test
current Parameter
re-read cookie
-------------------------------------------------