Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascript Ìæ»»¿Õ¸ñ

 1.×Ôhttp://jorkin.reallydo.com/article.asp?id=275
µÚÒ»´Î·¢ÏÖJavaScriptÖÐreplace() ·½·¨Èç¹ûÖ±½ÓÓÃstr.replace("-","!") Ö»»áÌæ»»µÚÒ»¸öÆ¥ÅäµÄ×Ö·û.
¶østr.replace(/\-/g,"!")Ôò¿ÉÒÔÈ«²¿Ìæ»»µôÆ¥ÅäµÄ×Ö·û(gΪȫ¾Ö±êÖ¾)¡£
replace()
The replace() method returns the string that results when you replace text matching its first argument
(a regular expression) with the text of the second argument (a string).
If the g (global) flag is not set in the regular expression declaration, this method replaces only the first
occurrence of the pattern. For example,
var s = "Hello. Regexps are fun.";s = s.replace(/\./, "!"); // replace first period with an exclamation pointalert(s);
produces the string “Hello! Regexps are fun.” Including the g flag will cause the interpreter to
perform a global replace, finding and replacing every matching substring. For example,
var s = "Hello. Regexps are fun.";s = s.replace(/\./g, "!"); // replace all periods with exclamation pointsalert(s);
yields this result: “Hello! Regexps are fun!”
ËùÒÔ¿ÉÒÔÓÃÒÔϼ¸ÖÖ·½Ê½.£º
string.replace(/reallyDo/g, replaceWith);
string.replace(new RegExp(reallyDo, 'g'), replaceWith);
string£º×Ö·û´®±í´ïʽ°üº¬ÒªÌæ´úµÄ×Ó×Ö·û´®¡£
reallyDo£º±»ËÑË÷µÄ×Ó×Ö·û´®¡£
replaceWith£ºÓÃÓÚÌæ»»µÄ×Ó×Ö·û´®¡£
<mce:script type="text/javascript"><!--
String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase) {
if (!RegExp.prototype.isPrototypeOf(reallyDo)) {
return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi": "g")), replaceWith);
} else {
return this.replace(reallyDo, replaceWith);
}
}
// --></mce:script>
±¾ÎÄÀ´Ô´ÓÚ KinJAVAÈÕÖ¾ (http://jorkin.reallydo.com)
Ô­ÎĵØÖ·: http://jorkin.reallydo.com/article.asp?id=275

2.×Ôhttp://yueguangyuan.javaeye.com/blog/31744
·½·¨£º string.replace(new RegExp(oldString,"gm"),newString))
gm     g=global, m=multiLine  £¬  ´óÖÂÉÏ·½·¨¾ÍÊÇÕâÑùµÄ£¬¿ÉÒÔʵÏÖ


Ïà¹ØÎĵµ£º

¹ØÓÚjavascriptСÊýµÄËÄÉáÎåÈë

 ÓÃJavascriptÈ¡floatÐÍСÊýµãºóÁ½Î»£¬Àý22.127456È¡³É22.13,ÈçºÎ×ö£¿
1. ×µÄ°ì·¨....... [ÎÒ¾ÍÔõô¸ÉµÄ.........]
function get()
{
    var s = 22.127456 + "";
    var str = s.substring(0,s.indexOf(".") + 3);
    alert(str);
}
2. ÕýÔò±í´ïʽЧ¹ ......

javascript±í¸ñÅÅÐò

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Power Table</title>
<style>
body{
FONT-SIZE: 9pt; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px;
}
input {
FONT-SIZE: 9pt; height: 15pt; width:50px; ......

javascriptѧϰ¼¼ÇÉ

 ºÜ¶àÈ˶¼²»Ô¸Òâдjavascript´úÂ룬ÎÒ¾õµÃÖ÷ÒªÔ­ÒòÔÚÓÚjavascript´úÂë±È½ÏÁãË飬ɿ¼°µÄÖªÊ¶Ãæ±È½Ï¹ã£¬ÒªÐ´ºÃjavascript´úÂ룬¾Í²»µÃ²»Á˽âhtml£¬cssµÈ£¬ËùÒÔҪѧºÃjavascript²¢²»ÊÇÒ»¼þÈÝÒ×µÄÊ¡£Èç¹ûÒªÊÇÓбȽϺõĿª·¢¹¤¾ßµÄ»°£¬ÏàÐÅ´ó¼ÒѧÆðÀ´»á¼òµ¥Ò»Ð©¡£ÏÂÃæ¸ø´ó¼Ò½éÉÜһЩѧϰjavascriptµÄ¹¤¾ß£º
1¡¢ÈçºÎ¿ìËÙ¿´ ......

JavaScriptÖеÄdocument.cookieµÄʹÓÃ

ÎÒÃÇÒѾ­ÖªµÀ£¬ÔÚ document ¶ÔÏóÖÐÓÐÒ»¸ö cookie ÊôÐÔ¡£µ«ÊÇ Cookie ÓÖÊÇʲô£¿“ijЩ Web Õ¾µãÔÚÄúµÄÓ²ÅÌÉÏÓúÜСµÄÎı¾Îļþ´æ´¢ÁËһЩÐÅÏ¢£¬ÕâЩÎļþ¾Í³ÆÎª Cookie¡£”—— MSIE °ïÖú¡£Ò»°ãÀ´Ëµ£¬Cookies ÊÇ CGI »òÀàËÆ£¬±È HTML ¸ß¼¶µÄÎļþ¡¢³ÌÐòµÈ´´½¨µÄ£¬µ«ÊÇ javascript Ò²ÌṩÁË¶Ô Cookies µÄºÜ ......

javascript½Úµã²Ù×÷DOMDocumentÊôÐԺͷ½·¨

×î½ü·¢ÏÖDOMDocument¶ÔÏóºÜÖØÒª,»¹ÓÐXMLHTTPÒ²ºÜÖØÒª
×¢Òâ´óСдһ¶¨²»ÄÜŪ´í.
ÊôÐÔ:
 1Attributes     ´æ´¢½ÚµãµÄÊôÐÔÁбí(Ö»¶Á)
 2childNodes     ´æ´¢½ÚµãµÄ×Ó½ÚµãÁбí(Ö»¶Á)
 3dataType     ·µ»Ø´Ë½ÚµãµÄÊý¾ÝÀàÐÍ
 4Definition ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ