javascriptÊ®½øÖÆת¶þ½øÖÆ£¬¶þ½øÖÆתʮ½øÖÆ
alert(parseInt("101101", 2))
ÔËÐдúÂë
function toBin(intNum) {
var answer = "";
if(/\d+/.test(intNum)) {
while(intNum != 0) {
answer = Math.abs(intNum%2)+answer;
intNum = parseInt(intNum/2);
}
if(answer.length == 0)
answer = "0";
return answer;
} else {
return 0;
}
}
alert(toBin(45))
ÔËÐдúÂë
function toBin(dec) {
var bits = [];
var dividend = dec;
var remainder = 0;
while (dividend >= 2) {
remainder = dividend % 2;
bits.push(remainder);
dividend = (dividend - remainder) / 2;
}
bits.push(dividend);
bits.reverse();
return bits.join("");
}
alert(toBin(45))
ÔËÐдúÂë
Ïà¹ØÎĵµ£º
ŬÁ¦ÁËÒ»ÌìÔÙ¼ÓÒ»Ì죬¾Íд¸ö½Å±¾»¹ÊDz»ÐС£Ôõô°ì¡£
ÏÂÃæµÄ´úÂëÓдíµÄ£¬Ö´Ðв»ÁË¡£ÔÝʱ»¹Ã»Óз¢ÏÖMyEclipseÀïÃæÈçºÎÀ´µ¥²½µ÷ÊÔ£¬¾ÍÏñÔÚvs2005ÀïÃæ¿ÉÒÔ°´×¡F10À´µ÷ÊÔ£¬¿´³ö×Ô¼ºµÄÄǸöÓï¾äд´íÁË£¬¶øÔÚÀïÖ»Äܹ»×Ô¼º¼ì²é£¬²éÁ˶àÉÙ±éÁËÒ²»¹ÊÇûÓÐÄܹ»·¢ÏÖÓÐʲô´íµÄ¡£´úÂëժ¼ÈçÏ£º
<script language="javaScript ......
<SCRIPT LANGUAGE="JavaScript">
var s = "";
s += "\r\nÍøÒ³¿É¼ûÇøÓò¿í£º"+ document.body.clientWidth;
s += "\r\nÍøÒ³¿É¼ûÇøÓò¸ß ......
Ч¹ûÑÝʾµØÖ·£ºhttp://www.phzzy.org/code/drag/google_drag.html
ÍÏקÔÀí£º
¹ØÓÚÍÏקµÄ»ù´¡£¬¿ÉÒԲο¼ÕâƪÎÄÕ£¬½²µÃ·Ç³£²»´í¡£
http://www.sohotx.com/mzk/index.php/1007/ArticleContent/298.html
ÆäʵÔÀíºÜ¼òµ¥£¬¾ÍÊÇ°Ñ°ó¶¨Èý¸öʼþ£ºonmousedown , onmousemove , onmouseup¡£
ÔÚÊó±êµãÏÂʱ(onmousedown)° ......
ÃèÊö event´ú±íʼþµÄ״̬£¬ÀýÈç´¥·¢event¶ÔÏóµÄÔªËØ¡¢Êó±êµÄλÖü°×´Ì¬¡¢°´ÏµļüµÈµÈ¡£ event¶ÔÏóÖ»ÔÚʼþ·¢ÉúµÄ¹ý³ÌÖвÅÓÐЧ¡£ eventµÄijЩÊôÐÔÖ»¶ÔÌض¨µÄʼþÓÐÒâÒå¡£±ÈÈ磬fromElement ºÍ toElement ÊôÐÔÖ»¶Ô onmouseover ºÍ onmouseout ʼþÓÐÒâÒå¡£ Àý×Ó ÏÂÃæµÄÀý×Ó¼ì²éÊó±êÊÇ·ñÔÚÁ´½ÓÉ ......
<script language="JavaScript" type="text/javascript" >
<!--
.
//-->
</script>
.languageÒѾ±»ÆúÓ㬵«ÎªÁ˼æÈݾɰ汾ä¯ÀÀÆ÷¶ø±£Áô£¬ËùÒÔ½¨ÒéͬʱʹÓÃÕâlanguageºÍtypeÁ½¸ö
.<!--- / ......