javascriptÖлñÈ¡Ò»¸ö×Ö·û´®ÖÐ Ìض¨×Ö·û´®µÄ¸öÊý
//ͳ¼Æ×Ö·û´®ÖÐÌض¨×Ö·û´®µÄ¸öÊý
function getStrCount(scrstr,armstr)
{ //scrstr Ô´×Ö·û´® armstr ÌØÊâ×Ö·û
var count=0;
while(scrstr.indexOf(armstr) >=1 )
{
scrstr = scrstr.replace(armstr,"")
count++;
}
return count;
}
Ïà¹ØÎĵµ£º
JavaScript replace() ·½·¨
JavaScript String ¶ÔÏó²Î¿¼ÊÖ²á
¶¨ÒåºÍÓ÷¨
replace() ·½·¨ÓÃÓÚÔÚ×Ö·û´®ÖÐÓÃһЩ×Ö·ûÌæ»»ÁíһЩ×Ö·û£¬»òÌæ»»Ò»¸öÓëÕýÔò±í´ïʽƥÅäµÄ×Ó´®¡£
Óï·¨
stringObject.replace(regexp,replacement)
²ÎÊýÃèÊö
regexp
±ØÐè¡£¹æ¶¨ÁËÒªÌæ»»µÄģʽµÄ RegExp ¶ÔÏó¡£Çë×¢Ò⣬Èç¹û¸ÃÖµÊÇÒ»¸ö×Ö·û´®£¬Ôò½ ......
ÉîÈëÀí½âJavaScriptµÄ±äÁ¿×÷ÓÃÓò
http://www.cnblogs.com/rainman/archive/2009/04/28/1445687.html
ÔÚѧϰJavaScriptµÄ±äÁ¿×÷ÓÃÓò֮ǰ£¬ÎÒÃÇÓ¦µ±Ã÷È·¼¸µã£º
a¡¢JavaScriptµÄ±äÁ¿×÷ÓÃÓòÊÇ»ùÓÚÆäÌØÓеÄ×÷ÓÃÓòÁ´µÄ¡£
b¡¢JavaScriptûÓп鼶×÷ÓÃÓò¡£
c¡¢º¯ÊýÖÐÉùÃ÷µÄ±äÁ¿ÔÚÕû¸öº¯ÊýÖж¼Óж¨Òå¡£
1¡¢JavaScriptµÄ×÷ÓÃÓòÁ´ ......
JavaScript
º¯Êý¶¨ÒåÓï·¨×ܽá
×÷Õß
»Æ³Ï
QQ
Ⱥ£º
65643887
1
£®Õý³£µÄ¶¨Òå·½·¨£º
function functionName([arguments]){
Javascript statements
[return expression]
}
Àý
1:
function evalScript( i, elem ) {
&n ......
ÔÚJavascriptÖÐûÓÐclassÀ࣬µ«ÊÇͬÑùÒ²¿ÉÒÔ½øÐжÔÏóµÄ´´½¨¡£ÔÚÃæÏò¶ÔÏóµÄÓïÑÔÖÐÐèҪʵÀý»¯Ä³¸ö¾ßÌåÀàµÄʵÀý£¬ÔÚJavascriptÖÐÔò²»Óá£
ÔÚJavascriptÀ¶ÔÏñ¿ÉÒÔ´´½¨ÐµĶÔÏó£¬Ò²¿ÉÒԼ̳Ð×ÔÆäËû¶ÔÏó¡£Õâ¸ö¸ÅÄî³ÆΪÔÐÍ»¯¼Ì³Ð(prototypal inheritance)¡£
Èκκ¯ÊýÔÚJavascript Öж¼¿ÉÒÔ±»ÊµÀý»¯Ò»¸ö¶ÔÏó¡£
³ÌÐòÈçÏ£º
// ......
ʵÏÖ¿¨Ò³Ê½webµÄjs£º
function ShowContent(id,num){
for(i=1;i<=num;i++){
document.getElementById("page_"+i).className="";
document.getElementById("content_"+i).style.display="none";
}
document.getElementById("content_"+id).style.display="block";
......