javascript php Ö®¼ä´«µÝ ÖÐÎÄ ±ÜÃâÂÒÂë
ÔÚjavascript´úÂëÖÐÓÃencodeURIComponent()º¯Êý´¦ÀíÖÐÎÄ×Ö·û´®£¬
JS´úÂ룺
<mce:script type=”text/javascript”><!--
string = encodeURIComponent(string);
location.href = index.php?keyword=’+string;
// --></mce:script>
PHP´úÂë:
<?php
$keyword = (isset($_GET['keyword'])) ? $_GET['keyword'] : '';
?>
±£Ö¤JavaScriptºÍAsp¡¢PhpµÈºó¶Ë³ÌÐò¼ä´«Öµ±àÂëͳһ
ÔÚ·ÇÓ¢ÎÄ×Ö·û¼¯µÄÒ³ÃæÉÏ£¬Èç¹ûʹÓÃAjax·½Ê½½øÐÐÊý¾Ý½»»¥µÄ»°£¬
¾Í±ØÐëҪעÒⱣ֤ǰºó¶ËÊý¾ÝµÄͳһ±àÂ룬·ñÔò£¬ºÜÈÝÒ׾ͳöÏÖÂÒÂ룡
ÔÚºó¶ËÊÇASP³ÌÐòµÄÇé¿öÏ£¬±£³ÖÇ°¶ËJavascriptºÍAspÖ®¼ä´«ÖµµÄͳһ±àÂë¿ÉÒÔʹÓÃÒÔϺ¯Êý½øÐд¦Àí£º
±àÂ룺escape(string)
½âÂ룺unescape(string)
ÕâÁ½¸öº¯ÊýÔÚJavaScriptºÍAspÀﶼ´æÔÚ£¬¶øÇÒ¹¦ÄÜÍêÈ«Ò»Ñù£¬
Ö»ÒªÈκÎÒ»¶ËÏòÁíÒ»¶Ë´«Êý¾Ý£¬¶¼ÏÈÓÃescape½øÐбàÂ룬
½ÓÊÕµÄÒ»¶ËÓÃunescape½øÐнâÂë¼´¿É±£Ö¤JavascriptºÍAspÊý¾Ý´«µÝ¹ý³ÌÖв»»á³öÏÖÂÒÂ룡
ÔÚºó¶ËÊÇPHP³ÌÐòµÄÇé¿öÏ£¬±£³ÖÇ°¶ËJavascriptºÍPHPÖ®¼ä´«ÖµµÄͳһ±àÂë¿ÉÒÔʹÓÃÒÔϺ¯Êý½øÐд¦Àí£º
WEBÇ°¶ËJavaScript
±àÂ룺encodeURI(string)
½âÂ룺decodeURI(string)
WEBºó¶ËPhp
±àÂ룺urlencode(string)
½âÂ룺urldecode(string)
ͬÑù£¬´«ÖµµÄʱºòʹÓÃÏàÓ¦µÄ±àÂ뺯ÊýencodeURI»òurlencode£¬
½ÓÊÕµÄʱºòʹÓÃÏàÓ¦µÄ½âÂ뺯ÊýdecodeURI»òurldecode£¬
¼´¿É±£Ö¤JavascriptºÍPhpÊý¾Ý´«µÝ¹ý³ÌÖв»»á³öÏÖÂÒÂ룡
ÔÚWEBÇ°¶ËJavascript½âÂë,PhpÀïurlencode±àÂëµÄÊý¾Ýʱ£¬¿ÉÄÜÐèҪʹÓÃÁ½´Î½âÂ룬È磺
unescape(decodeURI(string))
unescapeÓÃÀ´½âһЩ·Ç×Ö·ûÀàµÄÎÄ×Ö£¬Èç±êµã·ûºÅµÈµÈ¡£
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
IE event.keyCode
keycode 8 = BackSpace BackSpace
keycode 9 = Tab Tab
keycode 12 = Clear
keycode 13 = Enter
keycode &nb ......
°æȨÉùÃ÷£ºÔ´´×÷Æ·£¬ÔÊÐíתÔØ£¬×ªÔØʱÇëÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕ Ôʼ³ö´¦ ¡¢×÷ÕßÐÅÏ¢ºÍ±¾ÉùÃ÷¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£http://gzycm520.blog.51cto.com/175220/36822
· ʼþÔ´¶ÔÏó event.srcElement.tagName event.srcElement.type
· ²¶»ñÊÍ·Å event.srcElement.setCapture(); ......
echo "<script language='javascript'>
alert('ͼÊéÐÅÏ¢Ìí¼Ó³É¹¦!');history.back();</script>";
¡¾ ×ÖÌ壺<A href="javascript:ContentSize(16)">´ó</A>
......