javascript ¿ØÖÆ htmlÔªËØ ÏÔʾ/Òþ²Ø
javascript ¿ØÖÆ htmlÔªËØ ÏÔʾ/Òþ²Ø
1¡£±àдjsº¯Êý
<script type="text/javascript">
function display(y){$(y).style.display=($(y).style.display=="none")?"":"none";}
function $(s){return document.getElementById(s);}
</script>
2. ÒªÏÔʾ/Òþ²ØµÄhtmlÔªËؼÓÉÏ id ÊôÐÔ
<table>
<tr id="menu" >
<td>¿ØÖÆÕâ¸ötrµÄÏÔʾ/Òþ²Ø</td>
</tr>
</table>
3£¬Ìí¼Ó°´Å¥£¬Á´½ÓµÈ´¥·¢ js º¯Êý
<input type="button" onclick="display('menu')" value="ÏÔʾ/Òþ²Ø"/>
<a href="#" onclick="display('menu')" >ÏÔʾ/Òþ²Ø</a>
javascriptÏÔʾÒþ²Ø²ã<div id="layer" style="display:none;">¹ã¸æ</div>
<input type="botton" onclick="display(layer)">
¶þ:javascript¿ØÖÆÒ³Ãæ¿Ø¼þÒþ²ØÏÔʾµÄÁ½ÖÖ·½·¨
javascript¿ØÖÆÒ³Ãæ¿Ø¼þÒþ²ØÏÔʾµÄÁ½ÖÖ·½·¨£¬·½·¨µÄ²»Í¬Ö®´¦ÔÚÓڿؼþÒþ²ØºóÊÇ·ñ»¹ÔÚÒ³ÃæÉÏռλ
·½·¨Ò»£º
document.all["PanelSMS"].style.visibility="hidden";
document.all["PanelSMS"].style.visibility="visible";
·½·¨¶þ£º
document.all["PanelSMS"].style.display="none";
document.all["PanelSMS"].style.display="inline";
·½·¨Ò»Òþ²Øºó Ò³ÃæµÄλÖû¹±»¿Ø¼þÕ¼Óà ֻÊDz»ÏÔʾ
·½·¨¶þÒþ²Øºó Ò³ÃæµÄλÖò»±»Õ¼ÓÃ
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
stringObj ±ØÑ¡Ïî¡£ÒªÖ´ÐиÃÌæ»»µÄ String ¶ÔÏó»òÎÄ×Ö¡£¸Ã¶ÔÏ󲻻ᱻ replace ·½·¨Ð޸ġ£
rgExp ±ØÑ¡Ïî¡£ÃèÊöÒª²éÕÒµÄÄÚÈݵÄÒ»¸öÕýÔò±í´ïʽ¶ÔÏó¡£
replaceText ±ØÑ¡Ïî¡£ÊÇÒ»¸öString ¶ÔÏó»òÎÄ×Ö£¬¶ÔÓÚstringObj ÖÐÿ¸öÆ¥Åä rgExp ÖеÄλÖö¼ÓøöÔÏóËù°üº¬µÄÎÄ×Ö¼ÓÒÔÌæ»»¡£
ÏÂÃæµÄʾÀýÑÝʾÁË replace ·½·¨ ......
ÒÔÇ°ÔÚ¹«Ë¾¸ºÔð¹ã¸æÕâ¿é£¬Ôø¾Ñо¿¹ýÔÚWindows/Macintoshϵĸ÷ÖÖä¯ÀÀÆ÷ÖеÄjsÔËÐÐЧ¹û£¬¶ø×ܽá³öһЩ¼æÈݺ¯Êý¡£
ÓÃÔÚ¹«Ë¾ÍøÕ¾ÉÏÖ®ºó£¬Ã»Ïëµ½¾ÓÈ»ÓÐÐÒ±»Óû§ÃÇÄÃÈ¥µ±³ÉÁË·¶Àý£¨ÏÖÔÚÔÚÍøÉÏËÑ MK_pageX Ó¦¸ÃÄÜÕÒµ½²»ÉÙ£¬ÆäÖÐ MK_ ÊÇÎÒµÄÌØÕ÷ǰ׺£¬¾ÍÊÇ Moky µÄËõд£¬µ±Ê±ÊÇΪÁ˱ÜÃâºÍÔÓк¯Êý³åÍ»¶ø¼ÓµÄ£©£¬¹þ¹þ¡«
¿ÉÄܺÍÎÒ ......
Õâ¸ö¹ã¸æÒ²ÊDZȽϵäÐ͵ÄÒ»¸ö¸¡¶¯¹ã¸æ£¬ÒòΪÈç¹ûÄÜÕÒ×¼ÓÒϽǵÄλÖã¬ÄÇôҳÃæÉÏÈκÎÒ»¸öλÖÃÄãÒ²¶¼ÄÜÕÒµ½ÁË¡£
¶øÕâÀïÎÒ×Ô¼º±È½Ïϲ»¶µÄÊÇÄǸö magic_locus º¯Êý£¬
ËüÄÜʹµÃÄãµÄ¶¯×÷²½·¥¸ü¼ÓÓÅÃÀ£¬Í¨¹ýÒ»¸öºÜ¼òµ¥µÄ¹«Ê½¾ÍÄÜ´ïµ½ÔÚÒ³ÃæÉÏÁ貨΢²½µÄЧ¹û£¬
¶ø²»ÊÇÏñijЩÍøÕ¾ÄÇÑùºÜÉúÓ²µØÒƶ¯¡£
²»¶à˵ÁË£¬Ö±½Ó¿´´úÂ멤©¤
/ ......
javascriptÖеÄsubstr ºÍsubstringµÄÇø±ð:
1.substr ·½·¨
·µ»ØÒ»¸ö´ÓÖ¸¶¨Î»ÖÿªÊ¼µÄÖ¸¶¨³¤¶ÈµÄ×Ó×Ö·û´®¡£
stringvar.substr(start [, length ])
²ÎÊý
stringvar
±ØÑ¡Ïî¡£ÒªÌáÈ¡×Ó×Ö·û´®µÄ×Ö·û´®ÎÄ×Ö»ò String ¶ÔÏó¡£
start
±ØÑ¡Ïî¡£ËùÐèµÄ×Ó×Ö·û´®µÄÆðʼλÖá£×Ö·û´®ÖеĵÚÒ»¸ö×Ö·ûµÄË÷ÒýΪ 0¡£
length
¿ÉÑ¡Ïî¡£Ô ......