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

ÅäºÏjavascript¶¯Ì¬²Ù×÷±íÍ·

Õâ¶Îʱ¼äÔÚÓÃdisplayTag, ËüÓкܶàºÃÓõŦÄÜ,°³Ò²²»¾ÍÔÚÕâ׸Êö,µ±È»Ò²Óм¸¸ö²»·½±ãµÄµØ·½. ±ÈÈçÇóºÍºó"%"µÄÏÔʾµÈÓëÇóºÍÏà¹ØµÄȱµã, ÕâÀïÏȽéÉÜÒ»¸öȱµã²¢°ÑÎÒ´ÓÍøÉÏÕûÀí³öÀ´µÄ½â¾ö·½°¸Ò²Ò»²¢Ìû³ö. ÎÊÌâÊÇÕâÑùµÄ: ÓÉÓÚÒµÎñÒªÇó, µ±Óû§Êó±êλÓÚ±íÖÐijһÁеıêͷʱ, ÔÚÕâ¸ö±íÍ·"¶¯»­"µØÏÔʾÕâÁеļò½é. ÏÈ¿´ÏÂ×ö³öÀ´µÄЧ¹û:
   Èô²»ÓÃdisplaytagµÄ»°,Õâ¸öûʲôÀ§ÄѵÄ, Ö±½Ó¼ÓmouseOverʼþ¾ÍOKÁË.¿ÉÏÖÔÚÓÃdispalyTagºó, ÔÚ<display:column ..>ÖмӲ»ÁËonMouseOverµÄÏìӦʼþ,¼´±ãÊÇÄܼÓÕâ¸öÏìӦʼþµÄ»°, Ò²ÊǼӵ½ÁËÁÐÉÏ, û·¨¶¨Î»µ½µ±Ç°ÁеıíÍ·.
     Ôõô½â¾ö?
     дDisplayTagµÄ×°ÊÎÆ÷Ó¦¸Ã¿ÉÒÔ,µ«Ì«Âé·³.
     ÔÚJSPÉÏ×öÎÄÕ°É.
     ÄÇÖ»ÄÜÓÃJavaScriptÁË, ÒÔÇ°ÓÃDojoʱÓÐÕâ¸öЧ¹û,µ«½ö½öΪÁËÕâô¸ö¹¦ÄÜÒýÈëDojoÏÔÈ»ºÜ²»»®Ëã.
     ×Ô¼ºÐ´Ò»¸öJavaScript·½·¨.
     ÏÈÔÚÍøÉÏËÑÏ¿´¿´ÓÐûÓÐÀàËƵĽâ¾ö·½·¨, ÖÕÓÚÕÒµ½Ò»¸ö:
http://www.devx.com/webdev/10MinuteSolution/31020/0/page/3,¿´Ñù×ÓÐÐ, ÓÚÊǾÍÒÔËûµÄ·½·¨Îª³ö·¢µãÀ´Ð´.»¹ÓÐÒ»¸çÃÇ,ËûÏë¸ÄдdisplatTagµÄ²¿·ÖÔ´ÂëÒÔÖ§³ÖÄÇЩ³£¼ûµÄJavaScriptʼþ.
http: //jira.codehaus.org/browse/DISPL-187. Õâ¸öÅ£È˵ÄÎÊÌâÔÛÃÇÒÔºóÔÙÑо¿.
     »Øµ½ÔÛÃǵÄÖ÷ÌâÉÏÀ´. ÒÔËûµÄRowHandlers.jsΪ³ö·¢µãÔõôд? ·ÖΪÈý²½:
    1, ¶¨Î»µ½Ä¿±ê±íÍ·.Ò²¾ÍÊÇ˵ÈÃä¯ÀÀÆ÷ÖªµÀÓû§µÄÊó±ê·Åµ½Á˱íÍ·.
    2, ´¥·¢mouseOverʼþ,
    3, ÔÚʼþÀﶨλ˵Ã÷
     ÏÈ¿´µÚÒ»²½, Õâ¸öÊÇÓÐЩÂé·³,Èô²»ÊÇÓÃÁËFireFoxÀïµÄfirebugÀ´¸ú×ٲ鿴DOM,ÕâÒ»²½¾Íд²»³öÀ´. дÁ˸Ä,¸ÄÁËÔÙµ÷ÁËN±éºó, ÖÕÓڳɹ¦ÁË:
         var theadCells = document.getElementById(tableID).getElementsByTagName("thead")[0].rows[0].cells;
     Õâ¸ötheadCells¾ÍÊÇHTMLÖбíÍ·ÉϵÄһϵÁÐ<tr></tr>. tableIDÊÇ´«À´µÄ²ÎÊý, ±Ï¾¹displayTag»¹Ã»"¸É¾¡É±¾ø", ÈÃÔÛÃdzÌÐòÔ±µÃµ½Éú³ÉtableµÄid.
     ÔÙ¿´µÚ¶þ²½, Õâ¸öûʲô¿É˵µÄ, Ö±½Ó°´È˼ҷ½·¨À´¾ÍÐÐÁË:
    cell.onmouseover = function () {
       


Ïà¹ØÎĵµ£º

JavaScript¼¼ÇÉ


ת»¯ÎªBooleanÀàÐÍ
ËùÓÐJavaScriptÖеÄÖµ¶¼ÄÜÒþʽµÄת»¯ÎªBooleanÀàÐÍ£¬±ÈÈ磺
0 == false; // true
1 == true; // true
'' == false // true
null == false // true

µ«ÊÇÕâЩֵ¶¼²»ÊÇBooleanÀàÐÍ¡£
Òò´Ëµ±ÎÒÃÇʹÓÃÈý¸öµÈ ......

JavaScript»ñµÃ²ãµÄ¸ß¶È²¢ÊµÏÖÁ½¸ö²ã¸ß¶ÈµÄ×ÔÊÊÓ¦

var   a = document.getElementById("left");   
var   b = document.getElementById("right");   
if(a.scrollHeight < b.scrollHeight)   
{  
    a.style.height = b.scrollHeight+”px”;
} &nb ......

javascript replace µÄÕýÔò±í´ïʽ

replace()×î¼òµ¥µÄËãÊÇÄÜÁ¦¾ÍÊǼòµ¥µÄ×Ö·ûÌæ»»¡£ ʾÀý´úÂëÈçÏ£º
ËüÖ»Ìæ»»ÁËÊ××Öĸ¡£µ«Èç¹û¼ÓÉÏÕýÔò±í´ïʽ½á¹û¾Í²»Ò»ÑùÁË£¡replace()Ö§³ÖÕýÔò±í´ïʽ£¬Ëü¿ÉÒÔ°´ÕÕÕýÔò±í´ïʽµÄ¹æÔòÆ¥Åä×Ö·û»ò×Ö·û´®£¬È»ºó¸øÓèÌæ»»£¡ ×¢Ò⣺±»Ìæ»»µÄ²¿·Ö²»ÓüÓË«ÒýºÅ.
ÕâÑù»¹ÊÇÖ»Ìæ»»Á˵ÚÒ»¸ö×Öĸa¡£
ÓÉÉÏ¿ÉÖª£¬µ±ÕýÔò±í´ïʽÓÐ"g"±ê־ʱ£¬´ ......

¹ØÓÚjavascript ²Ù×÷¹â±ê

°æ±¾£ºDHTML Object Model¡¡·µ»ØÖµ£ºÓÐ
Óï·¨£º
oTextRange = object . createTextRange ()
²ÎÊý£º
ÎÞ
·µ»ØÖµ£º
oTextRange : ¶ÔÏó(Element)¡£Èç¹û³É¹¦µÄ»°·µ»Ø±»½¨Á¢µÄ TextRange ¶ÔÏó¡£
˵Ã÷£º
Ϊ object ½¨Á¢ TextRange ¶ÔÏó¡£
ʹÓÃ´Ë TextRange ¶ÔÏó¿ÉÒÔ¼ìË÷ºÍÐÞ¸Ä object ÄÚµÄÎı¾¡£ TextRange ¶ÔÏ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ