javascript CDATA
CDATA ÄÚ²¿µÄËùÓж«Î÷¶¼»á±»½âÎöÆ÷ºöÂÔ¡£
¼ÙÈçÎı¾Öаüº¬ÁË´óÁ¿µÄ "<" ºÍ "&" ×Ö·û - ¾ÍÏñ±à³Ì´úÂëÖо³£³öÏÖµÄÇé¿öÒ»Ñù - ÄÇôÕâ¸ö XML ÔªËؾͿÉÒÔ±»¶¨ÒåΪһ¸ö CDATA ²¿·Ö¡£
CDATA Çø¶Î¿ªÊ¼ÓÚ "<![CDATA["£¬½áÊøÓÚ "]]>"£º
<script type="text/javascript">
<![CDATA[
function compare(a,b)
{
if (a < b)
{alert("aСÓÚb");}
else if (a>b)
{alert("a´óÓÚb");}
else
{alert("aµÈÓÚb");}
}
]]>
</script>
ÔÚÉÏÃæµÄÀý×ÓÖУ¬ÔÚ CDATA Çø¶ÎÖеÄËùÓж«Î÷¶¼»á±»½âÎöÆ÷ºöÂÔ¡£
¹ØÓÚ CDATA Çø¶ÎµÄ×¢ÊÍ:
CDATA Çø¶Î²»ÄÜ°üº¬×Ö·û´® "]]>"£¬ËùÒÔ£¬CDATA Çø¶ÎµÄǶÌ×ÊDz»±»ÔÊÐíµÄ¡£
ͬʱҲÐèҪȷ±£ÔÚ "]]>" ×Ö·û´®ÖÐûÓпոñ»òÕÛÐС£
ΪʲôҪʹÓÃCDATA:
XHTMLµÄµÚ¶þ¸ö¸Ä±äÊÇʹÓÃCDATA¶Î¡£XMLÖеÄCDATA¶ÎÓÃÓÚÉùÃ÷²»Ó¦±»½âÎöΪ±êÇ©µÄÎı¾£¨XHTMLÒ²ÊÇÈç´Ë£©£¬ÕâÑù¾Í¿ÉÒÔʹÓÃÌØÊâ×Ö·û£¬Èç
СÓÚ£¨<£©¡¢´óÓÚ£¨>£©¡¢ºÍºÅ£¨&£©ºÍË«ÒýºÅ£¨"£©£¬¶ø²»±ØʹÓÃËüÃǵÄ×Ö·ûʵÌå¡£¿¼ÂÇÏÂÃæµÄ´úÂ룺
<script type="text/javascript">
function compare(a,b)
{
if (a < b)
{alert("aСÓÚb");}
else if (a>b)
{alert("a´óÓÚb");}
else
{alert("aµÈÓÚb");}
}
</script>
Õâ¸öº¯ÊýÏ൱¼òµ¥£¬Ëü±È½ÏÊý×ÖaºÍb£¬È»ºóÏÔʾÏûϢ˵Ã÷ËüÃǵĹØϵ¡£µ«ÊÇ£¬ÔÚXHTMLÖУ¬Õâ¶Î´úÂëÊÇÎÞЧµÄ£¬ÒòΪËüʹÓÃÁËÈý¸öÌØÊâ·ûºÅ£¬¼´Ð¡ÓÚ¡¢
´óÓÚºÍË«ÒýºÅ¡£ÒªÐÞÕýÕâ¸öÎÊÌ⣬±ØÐë·Ö±ðÓÃÕâÈý¸ö×Ö·ûµÄXMLʵÌå<¡¢>ºÍ"Ìæ»»ËüÃÇ£º
<script type="text/javascript">
function compare(a,b)
{
if (a <b)
{alert("aСÓÚb");}
else if (a>b)
{alert("a´óÓÚb");}
else
{alert("aµÈÓÚb");}
}
</script>
Õâ¶Î´úÂë´æÔÚÁ½¸öÎÊÌâ¡£Ê×ÏÈ£¬¿ª·¢Õß²»Ï°¹ßÓÃXMLʵÌå±àд´úÂë¡£Õâʹ´úÂëºÜÄѶÁ¶®¡£Æä´Î£¬ÔÚJavaScriptÖУ¬ÕâÖÖ´úÂëʵ¼ÊÉϽ«ÊÓΪÓÐÓï·¨
´í£
Ïà¹ØÎĵµ£º
º¯ÊýÊǽøÐÐÄ£¿é»¯³ÌÐòÉè¼ÆµÄ»ù´¡£¬±àд¸´ÔÓµÄAjaxÓ¦ÓóÌÐò£¬±ØÐë¶Ôº¯ÊýÓиüÉîÈëµÄÁ˽⡣JavaScriptÖеĺ¯Êý²»Í¬ÓÚÆäËûµÄÓïÑÔ£¬Ã¿¸öº¯Êý¶¼ÊÇ
×÷Ϊһ¸ö¶ÔÏó±»Î¬»¤ºÍÔËÐеġ£Í¨¹ýº¯Êý¶ÔÏóµÄÐÔÖÊ£¬¿ÉÒԺܷ½±ãµÄ½«Ò»¸öº¯Êý¸³Öµ¸øÒ»¸ö±äÁ¿»òÕß½«º¯Êý×÷Ϊ²ÎÊý´«µÝ¡£ÔÚ¼ÌÐø½²Êö֮ǰ£¬ÏÈ¿´Ò»Ïº¯ÊýµÄʹÓÃÓï
·¨£º
function func1(& ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>dragÀà</title ......
replace
·½·¨
ÒÔÏÂÊÇjavascript
ÖеÄÀý×Ó
ÏÂÃæµÄʾÀýÑÝʾÁË replace
·½·¨½«µÚÒ»´Î³öÏֵĵ¥´Ê "The"
Ì滻Ϊµ¥´Ê "A"
µÄÓ÷¨¡£
function ReplaceDemo(){
var r, re; & ......
Òý×Ô£ºhttp://www.cnblogs.com/dongritengfei/archive/2009/12/21/1628489.html
½ñÌìŪÁËÒ»ÌìµÄAjaxÖÐÎÄÂÒÂëÎÊÌ⣬AjaxµÄÂÒÂëÎÊÌâ·ÖΪÁ½ÖÖ£º
1. JavaScriptÊä³öµÄÖÐÎÄÂÒÂ룬
±ÈÈ磺alert("ÖÐÎÄÂÒÂë²âÊÔ");
½â¾öµÄ°ì·¨±È½Ï¼òµ¥£¬¾ÍÊÇ°ÑjspÀïËùÓеÄcharsetºÍpageEncodingµÄÖµ¶¼ÉèÖóÉÏàͬµÄ£¬Ò»°ãÊÇutf-8.
  ......
<input type=button onclick="aaa();" value="È·¶¨">
<iframe name="frame1">
<script language=javascript>
function aaa()
{
docume ......