JS¼¼Êõ

js°ÑÓ¢ÎÄÊ××Öĸ¸Ä³É´óд_Javascript½Ì³Ì

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2015-10-02 19:12 ÎÒÒªÆÀÂÛ( )

js°ÑÓ¢ÎÄÊ××Öĸ¸Ä³É´óд,ѧϰjs°ÑÓ¢ÎÄÊ××Öĸ¸Ä³É´óд,js°ÑÓ¢ÎÄÊ××Öĸ¸Ä³É´óд,²é¿´js°ÑÓ¢ÎÄÊ××Öĸ¸Ä³É´óд,±¾ÎĽéÉÜÈçºÎÓ¦ÓÃJS´úÂë°ÑÍøÒ³ÖеÄÓ¢ÎÄÊ××Öĸ¸Ä³É´óд

±¾ÎĽéÉÜÈçºÎÓ¦ÓÃJS´úÂë°ÑÍøÒ³ÖеÄÓ¢ÎÄÊ××Öĸ¸Ä³É´óд
µÚÒ»²½:°ÑÈçÏ´úÂë¼ÓÈë<head>ÇøÓòÖÐ

 ³ÌÐò´úÂë
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function changeCase(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.value.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)  {
for (index = 0; index < strLen; index++)  {
if (index == 0)  {
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))  {
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
         }
      }
   }
}
frmObj.value = tmpStr;
}
//http://www.knowsky.com  End -->
</script>

µÚ¶þ²½:°ÑÈçÏ´úÂë¼ÓÈë<body>ÇøÓòÖÐ

 ³ÌÐò´úÂë
<form name=form>
<input type=text name=box value="type in here!">
<input type=button value="Convert" onClick="javascript:changeCase(this.form.box)">
</form>

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • ѧϰJavaScriptÖ®this,call,apply

    ѧϰJavaScript֮this,call,apply

    2016-01-28 20:45

  • Áã»ù´¡ÈëÃÅѧϰPython£¨10£©£ºº¯Êý - qq_33256568µÄ²©¿Í - ²©¿ÍƵµÀ - CSDN.NET qq_3

    Áã»ù´¡ÈëÃÅѧϰPython£¨10£©£ºº¯Êý - qq_33256568µÄ²©¿Í - ²©¿ÍƵµÀ

    2015-12-15 09:04

  • Swift 2.0ѧϰ±Ê¼Ç£¨Day48£©¡ª¡ªÀàÐͼì²éÓëת»» - ¹Ø¶«Éý - ²©¿ÍƵµÀ - CSDN.NET ¹Ø¶«Éý iO

    Swift 2.0ѧϰ±Ê¼Ç£¨Day48£©¡ª¡ªÀàÐͼì²éÓëת»» - ¹Ø¶«Éý - ²©¿ÍƵµÀ

    2015-12-14 18:16

  • ÓÐȤµÄRuby-ѧϰ±Ê¼Ç1 - ÎÒ¿ÉÒÔ½ÓÊÜʧ°Ü£¬µ«ÎÒ²»ÄܽÓÊÜ·ÅÆú¡£--Âõ¿Ë¶û Çǵ¤ - ²©¿ÍƵµÀ - CSDN.NET

    ÓÐȤµÄRuby-ѧϰ±Ê¼Ç1 - ÎÒ¿ÉÒÔ½ÓÊÜʧ°Ü£¬µ«ÎÒ²»ÄܽÓÊÜ·ÅÆú¡£--Âõ¿Ë

    2015-12-14 17:17

ÍøÓѵãÆÀ
ë