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ÓïÑÔµÄÌØÊâÖ®´¦£¬¾ÍÔ ......
"These memory leaks often
occur as a result of circular references between JavaScript objects and
objects within IE’s DOM (document object model)."
GPDE Team Blog
Ã÷ÏÔµÄDOM¶ÔÏóÓë JavaScript¶ÔÏóÑ»·ÒýÓúܺÃÅжϣ¬ÄѵÄÊÇÒþº¬µÄÑ»·ÒýÓÃÅжϣ¡
Òþº¬µÄÑ»·ÒýÓÃÐèҪͨ¹ý×÷ÓÃÓòÁ´½øÐзÖÎöÅÐ ......
·½·¨Ò»:
¸öÈËÈÏΪ×îºÃµÄ·½·¨.²ÉÓõÄÊÇÕýÔò±í´ïʽ,ÕâÊÇ×îºËÐĵÄÔÀí.
Æä´Î.Õâ¸ö·½·¨Ê¹ÓÃÁËJavaScript µÄprototype ÊôÐÔ
ÆäʵÄ㲻ʹÓÃÕâ¸öÊôÐÔÒ»Ñù¿ÉÒÔÓú¯ÊýʵÏÖ.µ«ÕâÑù×öºóÓÃÆðÀ´±È½Ï·½±ã.
ÏÂÃæ¾ÍÀ´¿´¿´Õâ¸öÊôÐÔÊÇÔõôÀ´ÓõÄ.
·µ»Ø¶ÔÏóÀàÐÍÔÐ͵ÄÒýÓá£
objectName.prototype
objectName ²ÎÊýÊǶÔÏóµÄÃû³Æ¡£ ......
function getHeight(){
var yScroll;
if (window.innerHeight && window.scrollMaxY) {
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offs ......
function getInfo()
{
var s = "";
s += " ÍøÒ³¿É¼ûÇøÓò¿í£º"+ document.body.clientWidth+"\n";
s += " ÍøÒ³¿É¼ûÇøÓò¸ß£º"+ document.body.clientHeight+"\n";
s += " ÍøÒ³¿É¼ ......