JavaScript FAQ£¨¶þÊ®ËÄ£©
¶þʮһ¡¢ÉùÒô
1¡¢¿ÉÒÔ²¥·ÅÉùÒôµÄä¯ÀÀÆ÷£¨Audio-enabled Browsers£©
Q£ºÊ²Ã´¿ÉÒÔä¯ÀÀÆ÷¿ÉÒÔÖ´Ðв¥·ÅÉùÒôµÄ½Å±¾£¿
A£ºÈç¹ûÔÚÉùÒô²¥·ÅÃèÊöµÄ¼¼Êõ¿ÉÒÔÔÚMiscrosoft Internet Explorer 4.0¼°Æä¸üа汾Öй¤×÷£¬ÄÇôͬÑù¿ÉÒÔÔÚNetscape Navigator 3.0¼°Æä¸üа汾Öй¤×÷¡£ÒªÔÚInternet ExplorerÖв¥·ÅÉùÒô£¬ÔÚ4.0ÒÔ¼°ºóÀ´°æ±¾ÖвâÊÔ¾Í×ã¹»ÁË¡£È»ºóÔÚNetscape NavigatorÖУ¬Äã±ØÐëÈ·±£ÒÔϼ¸µã£º
ä¯ÀÀÆ÷°æ±¾ÊÇ3.0»òÕ߸üа汾
ÆôÓÃJava£¨²»½ö½öÊÇJavaScript£¡£©
ä¯ÀÀÆ÷Äܹ»Ê¶±ðÄãÒª²¥·ÅÒôƵÎļþµÄmimeÀàÐÍ
LiveAudio²å¼þ¿ÉÓÃ
ÀýÈ磬Èç¹ûÄãÏëÔÚÏÂÃæµÄEMBED±ê¼ÇÖв¥·ÅÉùÒôÎļþmySound.mid
<EMBED NAME="mySound" SRC="mySound.mid" mce_SRC="mySound.mid"
LOOP=FALSE AUTOSTART=FALSE HIDDEN=TRUE MASTERSOUND>
ÄÇô£¬¾ÍÐèҪʹÓÃÏÂÃæµÄ´úÂë½øÐвâÊÔ£º
ver=parseInt(navigator.appVersion)
if (ver>2 && navigator.appName=="Netscape"
&& navigator.mimeTypes['audio/x-midi']
&& navigator.javaEnabled()
&& document.mySound.IsReady() )
{
// put Netscape-specific code here
}
if (ver>3 && navigator.appName.indexOf("Microsoft")!=-1)
{
// put Explorer-specific code here
}
2¡¢ÒôƵÎļþ¸ñʽ£¨Audio File Formats£©
Q£ºÍøÒ³¿ÉÒÔ²¥·ÅÄÇЩÀàÐ͵ÄÒôƵÎļþ£¿
A£ºËùÓÐÆôÓÃÒôƵµÄä¯ÀÀÆ÷¶¼Ö§³Ö»Ø·ÅWAVºÍMIDI¸ñʽ£¨.mid¡¢.midiºÍ.wavÎļþ£©µÄÒôƵÎļþ¡£¸ù¾ÝÓû§ä¯ÀÀÆ÷ºÍϵͳÅäÖõIJ»Í¬µÄ£¬ÆäËû¸ñʽÎļþÒ²ÐíÖ§³Ö»ò²»Ö§³Ö¡£ÀýÈ磬ReadAudioÖ»ÄÜÓû§°²×°ÁËRealPlayer²Å¿ÉÒԻطš£
3¡¢Ê¹ÓÃJavaScript²¥·ÅÉùÒô£¨Playing Sound from JavaScript£©
Q£ºÎÒÈçºÎ±àдһ¸ö²¥·ÅÉùÒôJavaScript½Å±¾ÄØ£¿
A£ºÓм¸ÖÖ²»Í¬µÄ·½Ê½¿ÉÒÔͨ¹ýJavaScript²¥·ÅÉùÒô¡£ÎÒÃÇÀ´¿´¼¸¸öÀý×Ó£º
ʾÀý1. ÕâÊÇÒ»¸ö×î¼òµ¥µÄ²¥·ÅÉùÒôÎļþµÄ¿çä¯ÀÀÆ÷½Å±¾£º
self.location="AUDIO_FILE_URL"
µã»÷ÕâÀï²âÊÔʾÀý1´úÂë¡£ä¯ÀÀÆ÷»á´ò¿ªÒ»¸öµ¥¶ÀµÄÉùÒô¿ØÖÆ´°¿Ú¡£ÄÇôÓû§ÐèÒªÊÖ¶¯¹Ø±ÕÕâ¸ö´°¿Ú¡£×¢Ò⣬ʾÀý1¶ÔÓû§²¢²»ÓѺãºÓû§Ã¿Ò»´Îµã»÷ÔËÐнű¾£¬ä¯ÀÀÆ÷¶¼»á´ò¿ªÒ»¸öеÄÉùÒô¿ØÖÆ´°¿Ú£¬¼´Ê¹ÒѾÓÐÒôƵ´°¿ÚÒѾÔÚ²¥·ÅͬÑùµÄÎļþ£¡
ʾÀý2. ÕâÊÇÒ»¸ö¸ü¼Ó¸´ÔÓµÄÀý×Ó£¬Õâ¸öÀý×ÓûÓе¥¶ÀµÄÉùÒô¿ØÖÆ´°¿Ú¡££¨ÏÂÃæÓйØÓÚÕâ¸öÀý×ÓµÄÌÖ
Ïà¹ØÎĵµ£º
±Õ°ü£¨closure£©ÊÇJavascriptÓïÑÔµÄÒ»¸öÄѵ㣬ҲÊÇËüµÄÌØÉ«£¬ºÜ¶à¸ß¼¶Ó¦Óö¼ÒªÒÀ¿¿±Õ°üʵÏÖ¡£
ÏÂÃæ¾ÍÊÇÎÒµÄѧϰ±Ê¼Ç£¬¶ÔÓÚJavascript³õѧÕßÓ¦¸ÃÊǺÜÓÐÓõġ£
Ò»¡¢±äÁ¿µÄ×÷ÓÃÓò
ÒªÀí½â±Õ°ü£¬Ê×ÏȱØÐëÀí½âJavascriptÌØÊâµÄ±äÁ¿×÷ÓÃÓò¡£
±äÁ¿µÄ×÷ÓÃÓòÎ޷ǾÍÊÇÁ½ÖÖ£ºÈ«¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿¡£
JavascriptÓïÑÔµÄÌØÊâÖ®´¦£¬¾ÍÔ ......
ÉîÈëÀí½âJavascript±Õ°ü
×î½üÔÚÍøÉϲéÔÄÁ˲»ÉÙJavascript±Õ°ü(closure)Ïà¹ØµÄ×ÊÁÏ£¬Ð´µÄ´ó¶àÊǷdz£µÄѧÊõºÍרҵ¡£¶ÔÓÚ³õѧÕßÀ´Ëµ±ð˵Àí½â±Õ°üÁË£¬¾ÍÁ¬ÎÄ×ÖÐðÊö¶¼ºÜÄÑ¿´¶®¡£×«Ð´´ËÎĵÄÄ¿µÄ¾ÍÊÇÓÃ×îͨË×µÄÎÄ×Ö½Ò¿ªJavascript±Õ°üµÄÕæÊµÃæÄ¿¡£
¡¡¡¡Ò»¡¢Ê²Ã´ÊDZհü£¿
¡¡¡¡“¹Ù·½”µÄ½âÊÍÊÇ£ºËùν“±Õ°ü ......
1. ÍøÒ³Öв¶»ñJavaScript´íÎóµÄÁ½ÖÖ·½·¨£º
ʹÓà onerror ʼþÊÇÒ»ÖÖÀÏʽµÄ±ê×¼µÄÔÚÍøÒ³Öв¶»ñ Javascript ´íÎóµÄ·½·¨
throw ÉùÃ÷µÄ×÷ÓÃÊÇ´´½¨ exception£¨Òì³££©¡£Äã¿ÉÒÔ°ÑÕâ¸öÉùÃ÷Óë try...catch ÉùÃ÷ÅäºÏʹÓã¬ÒÔ´ïµ½¿ØÖƳÌÐòÁ÷²¢²úÉú¾«È·´íÎóÏûÏ¢µÄÄ¿µÄ¡£
2.Á½¸öJavaScriptÎļþ¼äº¯ÊýµÄµ÷ÓÃ
http://space.flash8.net ......
CSDNµÄBlog±È½ÏÇ¿º·£¬Ò»ÆªÎÄÕÂÄÜдÄÇô¶à£¬´ó¼ÒÈ¥³ö´¦¿´°É£¬ÄǶùºÃ¿´Ð©£ºhttp://blog.csdn.net/panxuan/archive/2007/11/26/1902826.aspx
ʼþÔ´¶ÔÏó
event.srcElement.tagName
event.srcElement.type
²¶»ñÊÍ·Å
event.srcElement.setCapture();
event.srcElement.releaseC ......
Ïê̽TextRange¶ÔÏó--²éÕÒÓëÑ¡Ôñ
TextRange¶ÔÏóÊǶ¯Ì¬HTML(DHTML)µÄ¸ß¼¶ÌØÐÔ£¬Ê¹ÓÃËü¿ÉÒÔʵÏֺܶàºÍÎı¾ÓйصÄÈÎÎñ£¬ÀýÈçËÑË÷ºÍÑ¡ÔñÎı¾¡£Îı¾·¶Î§ÈÃÄú¿ÉÒÔÑ¡ÔñÐԵĽ«×Ö·û¡¢µ¥´ÊºÍ¾ä×Ó´ÓÎĵµÖÐÌôÑ¡³öÀ´¡£TextRange¶ÔÏóÊÇÔÚHTMLÎĵµ½«ÒªÏÔʾµÄÎı¾Á÷ÉϽ¨Á¢¿ªÊ¼ºÍ½áÊøÎ»ÖõijéÏó¶ÔÏó¡£
ÏÂÃæÊÇTextRangeµÄ³£ÓÃÊôÐÔÓë·½·¨£º
Ê ......