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

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»ÏÔʾ 
·½·¨¶þÒþ²Øºó Ò³ÃæµÄλÖò»±»Õ¼ÓÃ


Ïà¹ØÎĵµ£º

JavaScriptµ÷ÓÃswfÖк¯Êý

The ExternalInterface API
        ֮ǰÎÒÃÇʹÓÃflashµ÷ÓÃjavascriptº¯Êý£¬Ò»°ãʹÓÃÕâÑùµÄ·½·¨£º
´úÂë:
getURL(¡°javascript:alert(¡®hello zhang-chao.com¡¯);¡±); //×¢Òâ×Ö·û´® Ë«ÒýºÅ ÀïÃæ¼Óµ¥ÒýºÅ
µ«ÊÇʹÓÃÕâÖÖ·½·¨´Óflashµ÷ÓÃjavascriptº¯ÊýÈÔ´æÔÚÐí¶àÀ§ÄÑ ......

HTMLÖ®meta

 metaÊÇhtmlÓïÑÔheadÇøµÄÒ»¸ö¸¨ÖúÐÔ±êÇ©¡£¼¸ºõËùÓеÄÍøÒ³ÀÎÒÃÇ¿ÉÒÔ¿´µ½ÀàËÆÏÂÃæÕâ¶ÎµÄhtml´úÂ룺
¡¡¡¡£¼head£¾
¡¡¡¡£¼meta http-equiv="content-Type" content="text/html; charset=gb2312"£¾
¡¡¡¡£¼/head£¾
¡¡¡¡Ò²ÐíÄãÈÏΪÕâЩ´úÂë¿ÉÓпÉÎÞ¡£ÆäʵÈç¹ûÄãÄܹ»ÓúÃmeta±êÇ©£¬»á¸øÄã´øÀ´ÒâÏë² ......

javascriptÃæÏò¶ÔÏóѧϰ(1) ´úÂë¼´ÎÄÕÂ

 <!-- ѧϰ×ÔjavaeyeµÄÎÄÕ  ÇëתÌùÕß×¢×Ô³ö´¦  learner:nilinfa -->
<HTML>
<script>
  /*¶¨ÒåÒ»¸öеĶÔÏó*/
  var emptyObject1 = {};
  /*¶¨ÒåÒ»¸öеĶÔÏó*/
  var emptyObject2 =  new Object();
  /*¶¨ÒåÒ»¸öеĶÔÏ󣬼üÖµ¶ÔÓ¦*/
  v ......

ÓÃjavascript¶¯Ì¬ÉèÖÃcssÑùʽµÄÖµ

 css¿ØÖÆλÖãº
´¿Êý×Ö
el.style.posLeft = 0;
el.style.posTop = 0;
Êý×Ö+µ¥Î»
el.style.left = "0px";
el.style.top = "0px";
css¿ØÖÆÔªËصÄÑùʽ£º
document.getElementById("para").style.fontWeight ="bold";
»ò£¨ÆäËûÒ²ÊÇÕâÑù£©£º
document.getElementById("para").className ="strong"; ......

javascript ֪ʶ ±Ê¼Ç

javascriptÖеÄsubstr ºÍsubstringµÄÇø±ð:
1.substr ·½·¨
·µ»ØÒ»¸ö´ÓÖ¸¶¨Î»ÖÿªÊ¼µÄÖ¸¶¨³¤¶ÈµÄ×Ó×Ö·û´®¡£
stringvar.substr(start [, length ])
²ÎÊý
stringvar
±ØÑ¡Ïî¡£ÒªÌáÈ¡×Ó×Ö·û´®µÄ×Ö·û´®ÎÄ×Ö»ò String ¶ÔÏó¡£
start
±ØÑ¡Ïî¡£ËùÐèµÄ×Ó×Ö·û´®µÄÆðʼλÖá£×Ö·û´®ÖеĵÚÒ»¸ö×Ö·ûµÄË÷ÒýΪ 0¡£
length
¿ÉÑ¡Ïî¡£Ô ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ