JavaScriptµÄreplace·½·¨ÓëÕýÔò±í´ïʽ½²½â
replace·½·¨µÄÓï·¨
ÊÇ£ºstringObj.replace(rgExp, replaceText)
ÆäÖÐstringObjÊÇ×Ö·û´®(string)£¬reExp¿ÉÒÔÊÇÕýÔò±í´ïʽ¶ÔÏó(RegExp)Ò²¿ÉÒÔÊÇ×Ö·û´®
(string)£¬replaceTextÊÇÌæ´ú²éÕÒµ½µÄ×Ö·û´®¡£¡£ÎªÁË°ïÖú´ó¼Ò¸üºÃµÄÀí½â£¬ÏÂÃæ¾Ù¸ö¼òµ¥Àý×Ó˵Ã÷Ò»ÏÂ
<script language="javascript">
var stringObj="ÖÕ¹ÅÈËÃñ¹²ºÍ¹ú£¬ÖÕ¹ÅÈËÃñ";
//Ìæ»»´í±ð×Ö“ÖչŔΪ“Öйú”
//²¢·µ»ØÌæ»»ºóµÄÐÂ×Ö·û
//Ô×Ö·û´®stringObjµÄֵûÓиıä
var newstr=stringObj.replace("ÖÕ¹Å","Öйú");
alert(newstr);
</script>
±ÈÎÒ´ÏÃ÷µÄÄ㣬¿´ÍêÉÏÃæµÄÀý×ÓÖ®ºó£¬»á·¢ÏÖµÚ¶þ¸ö´í±ð×Ö“ÖչŔ²¢Ã»Óб»Ìæ»»³É“Öйú”£¬ÎÒÃÇ¿ÉÒÔÖ´Ðжþ´Îreplace·½·¨°ÑµÚ¶þ¸ö´í±ð×Ö“ÖչŔҲÌæ»»µô£¬³ÌÐò¾¹ý¸Ä½øÖ®ºóÈçÏ£º
<script language="javascript">
var stringObj="ÖÕ¹ÅÈËÃñ¹²ºÍ¹ú£¬ÖÕ¹ÅÈËÃñ";
//Ìæ»»´í±ð×Ö“ÖչŔΪ“Öйú”
//²¢·µ»ØÌæ»»ºóµÄÐÂ×Ö·û
//Ô×Ö·û´®stringObjµÄֵûÓиıä
var newstr=stringObj.replace("ÖÕ¹Å","Öйú");
newstr=newstr.replace("ÖÕ¹Å","Öйú");
alert(newstr);
</script>
ÎÒÃÇ¿ÉÒÔ×ÐϸµÄÏëһϣ¬Èç¹ûÓÐNµÄN´Î·½¸ö´í±ð×Ö£¬ÊDz»ÊÇÒ²ÒªÖ´ÐÐNµÄN´Î·½replace·½·¨À´Ìæ»»µô´í±ð×ÖÄØ£¿£¿ºÇ£¬²»ÓÃÅ£¬ÓÐÁËÕýÔò±í´ïʽ֮ºó²»ÓÃÒ»¸ö´í±ð×ÖÒªÖ´ÐÐÒ»´Îreplace·½·¨¡£¡£³ÌÐò¾¹ý¸Ä½øÖ®ºóµÄ´úÂëÈçÏÂ
<script language="javascript">
var reg=new RegExp("ÖÕ¹Å","g"); //´´½¨ÕýÔòRegExp¶ÔÏó
var stringObj="ÖÕ¹ÅÈËÃñ¹²ºÍ¹ú£¬ÖÕ¹ÅÈËÃñ";
var newstr=stringObj.replace(reg,"Öйú");
alert(newstr);
</script>
ÉÏÃæ½²µÄÊÇreplace·½·¨×î¼òµ¥µÄÓ¦Ó㬲»ÖªµÀ´ó¼ÒÓÐûÓп´¶®£¿£¿ÏÂÃ濪ʼ½²ÉÔ΢¸´ÔÓÒ»µãµÄÓ¦Óᣡ£
´ó¼ÒÔÚһЩÍøÕ¾ÉÏËÑË÷ÎÄÕµÄʱºò£¬»á·¢ÏÖÕâôһ¸öÏÖÏ󣬾ÍÊÇËÑË÷µÄ¹Ø¼ü×Ö»á¸ßÁÁ¸Ä±äÑÕÉ«ÏÔʾ³öÀ´£¿£¿ÕâÊÇÔõôʵÏÖµÄÄØ£¿£¿ÆäʵÎÒÃÇ¿ÉÒÔÓÃÕýÔò±í´ïʽÀ´ÊµÏÖ£¬¾ßÌåÔõôÑùʵÏÖÄØ£¿¼òµ¥µÄÔÀíÇë¿´ÏÂÃæµÄ´úÂë
<script language="javascript">
var str=&quo
Ïà¹ØÎĵµ£º
ÓÉÓÚ»ðºüä¯ÀÀÆ÷²»Ö§³Ö“removeNode”º¯Êý£¬ËùÒÔһϴúÂëÖ»Ö§³ÖIE.
<!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>
< ......
ÔÚjavascriptÖеõ½µ±Ç°´°¿ÚµÄ¸ßºÍ¿í
<body><SCRIPT LANGUAGE="JavaScript">
var s = "";
s += "\r\nÍøÒ³¿É¼ûÇøÓò¿í£º"+ document.body.clientWidth;
s += "\r\nÍøÒ³¿É¼ûÇøÓò¸ß£º"+ document.body.clien ......
1 history.go(0)
2 location.reload() £¨Ò³Ãæ½øÐÐˢУ¬µ«ÎªdisabledµÄÔªËصÄÖµ²»»á±»Çå¿Õ£©
3 location=location
4 location.assign(location)
5 location.replace(location)
6 from..reset() (Ò³Ãæ²»½øÐÐˢУ¬Ä£Äâµ¥»÷¶ÔËùµ÷ÓÃ±íµ¥ÖØÖð´Å¥µÄµ¥»÷)
......
JavaScriptµÄä¯ÀÀÆ÷¶ÔÏóÏê½â
Ò»¡¢ä¯ÀÀÆ÷¶ÔÏó²ã´Î¼°ÆäÖ÷Òª×÷ÓÃ
¶þ¡¢Îĵµ¶ÔÏó¹¦Äܼ°Æä×÷ÓÃ
Èý¡¢·¶Àý
ʹÓÃä¯ÀÀÆ÷µÄÄÚ²¿¶ÔÏóϵͳ, ¿ÉʵÏÖÓëHTMLÎĵµ½øÐн»»¥¡£ËüµÄ×÷ÓÃÊǽ«Ïà¹ØÔªËØ×éÖ¯°ü×°ÆðÀ´£¬Ìṩ¸ø³ÌÐòÉè¼ÆÈËԱʹÓ㬴Ӷø¼õÇá±à³ÌÈ˵ÄÀͶ¯£¬Ìá¸ßÉè¼ÆWebÒ³ÃæµÄÄÜÁ¦¡£
Ò»¡¢ä¯ÀÀÆ÷¶ÔÏó²ã´Î¼°ÆäÖ ......
javascriptдÔÚº¯ÊýÀïÃæ
function loadscript(url) {
document.write('<scr' + 'ipt type="text/javascript" src"' + url + '"><\/scr' + 'ipt>'>)
}
Ôڳɹ¦µÄÕýÔò±í´ïʽ²éÕÒÍê³É֮ǰ£¬ÆäÊôÐÔֵΪ undefined¡£
²»Òª½«È«¾Ö RegExp ¶ÔÏóÓë ÕýÔò±í´ïʽ
¶ÔÏó»ìÏý¡£¾¡¹ÜÌýÆðÀ´Ï ......