·þÎñÆ÷½Å±¾ÓëJavascriptµÄÁ½ÖÖ½»»¥·½Ê½(ÒÔphpΪÀý)
·þÎñÆ÷½Å±¾ÓëJavascriptµÄÁ½ÖÖ½»»¥·½Ê½(ÒÔphpΪÀý)
ÒýÓÃ:http://www.knowsky.com/1014.html
ÔÚÍøÒ³ÖÆ×÷¹ý³ÌÖÐÔõÑùÔÚ²»Ë¢ÐÂÒ³ÃæµÄÇé¿öÏÂʹǰ̨ҳÃæºÍºǫ́CGIÒ³Ãæ±£³Ö½»»¥Ò»Ö±ÊǸöÎÊÌâ¡£ÕâÀï½éÉÜÁ½¸ö·½·¨¡£
·½·¨Ò»£ºÍ¨¹ý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
------------------------------------------------------------------------------------------------------------------------------
<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>±¾Ò³Ê¹ÓÃÒ³Ãæ¿ò¼Ü£¬µ«ÊÇÄúµÄä¯ÀÀÆ÷²»Ö§³Ö¡£</p>
</body>
</noframes>
</html>
------------------------------------------------------------------------------------------------------------------------------
action.php
------------------------------------------------------------------------------------------------------------------------------
<?php
srand((double)microtime()*1000000);
$result=rand(0,100);
setcookie("action",$result,time()+900,"/");
?>
------------------------------------------------------------------------------------------------------------------------------
main.htm
------------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Test</title>
&l
Ïà¹ØÎĵµ£º
ÔÚPBÖÐʹÓÃJavaScript½Å±¾º¯Êý
ÔÚPBÖÐʹÓÃJavaScript½Å±¾º¯Êý
ÏÖÔÚÐí¶àµÄÐÅϢϵͳ¶¼ÊÇ»ùÓÚB/S°æ±¾£¬µ«PBдµÄÐÅϢϵͳÉú´æ¿Õ¼äÒ²±È½Ï´ó£¬ÍùÍùÊÇÒ»¸öÐÅϢϵͳ¼´ÓÐPB°æ±¾Ò²ÓÐB/S°æ±¾¡£ÐÅϢϵͳ»áÓÐÐí¶àµÄÒµÎñ¹æÔò£¬B/SÖÐÒµÎñ¹æÔòµÄ¼ì²éÔÚJavaScript½Å±¾ÖÐʵÏÖ£¬Èç¹ûÔÚPBÖÐÓÖʵÏÖÒ»´Î£¬·Ñʱ·ÑÁ¦²»Ëµ£¬
ÒµÎñ¹æÔò¸Ä±äÓÖÒªÖØб ......
javascript ÉèÖÃcookie×¢ÒâÊÂÏî
javascript ÉèÖÃcookie×¢ÒâÊÂÏî
ÔÚJavascript ÖУ¬cookie ¿ÉÒÔͨ¹ý document.cookie½øÐÐÉèÖ㬵±ÉèÖöà¸öcookieʱä¯ÀÀÆ÷»á×Ô¶¯°Ñ
ËüÃÇÓ÷ֺŸô¿ª¡£ÈçÏ£º
document.cookie = 'cookie1';
document.cookie ='cookie2';
alert (document.cookie) ;//Êä³ö cookie1 ; cookie2
µ«ÊÇÈç¹û°ÑµÚ ......
½øÐÐÎļþµÄ¶ÁºÍд£¬ÏÈ´ò¿ªÒ»¸öÎļþ£¬È»ºó¿ªÊ¼¶Á»òÕßдÎļþ£¬×îºóÔÙ¹ØϵÕâ¸öÎļþ×ÊÔ´¡£
È磬ÎļþµÄ¶Á²Ù×÷£º
<?php
$file = fopen('your file path','r');
while(!feof($file)){ //µ±Ã»ÓжÁÈ¡µ½Îļþ½á⣬¼ÌÐøÑ»·¶ÁÈ¡²Ù×÷
$line = fgets($file); //¶ÁÈ¡µ½Ò»ÐеÄÄÚÈÝ
echo $line.'<br/>';
}
fclose($file) ......
´ó¼Ò¿ÉÄܶ¼Óöµ½¹ýÔÚдjavascirpt´úÂëʱ´«µÝÖÐÎÄ£¬ÔÚºǫ́ȡµ½Ê±·¢ÏÖÊÇÂÒÂ룬ÕâÀï°ÑÎÒ½ñÌì×öµÄ·½·¨Ð´³öÀ´£¬Ï£Íû¶Ô´ó¼ÒÒÔºóÓÐÓã¡
·½·¨£¨Ò»£©£º
htmlÒ³Ã棺
function testOne() {
var url = "testOne_test.do?expr="+ÄãºÃ;
location = encodeURI(url);
}
ºǫ́java´úÂ룺
String expr = ne ......
/*
* JavaScript¶ÔÏó¾ÍÊÇÒ»×éÊôÐÔ£¨·½·¨£©µÄ¼¯ºÏ
* ÔÚ¸ÃÓïÑÔÖÐÈç¹û±äÁ¿Ãû»ò·½·¨Ãû²»·ûºÏÉùÃ÷¹æ·¶£¬
* ÔòÒ»¶¨µÃÓ÷½À¨ºÅ“ [] ”ÒýÓÃËü
*
*/
/**
* <1.>¸ÃÓï¾äÉùÃ÷ÁËÒ»¸öclass1À࣬class1Ï൱ÓÚ¹¹Ôì·½·¨£¬Óֽй¹ÔìÆ÷
* Ò²¿É˵ÉùÃ÷ÁËÒ»¸öclass1·½·¨
......