We are using
How PHP interacts with Javascript: Through cookies. There are three files in total:
Index.htm,action.php, main.htm
The principle is that the front page main.htmand the rear action.php are connected to the page frame, and index.htm is organized to set the page width of action. php to 0, which does not affect the display. Action.php puts the information into cookie, and main.htm reads the information
Cookie. In main.htm, you can also control the background CGI program by re-reading action. php.
PHP and Javascript interaction implementation code:
- <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>
- <?
- Srand (double) microtime () * 1000000 );
- $ Result = revert (0,100 );
- Setcookie ("action", $ result, time () 900 ,"/");
- ?>
The above is the specific implementation of PHP and Javascript interaction.