JavaScript TextBoxÊäÈëÊý×Ö¿ØÖÆ
var OnPasteCheckIntNum = function()
{
if(window.clipboardData)
{
if(isNaN(window.clipboardData.getData('text')))
{
clipboardData.setData('text','');
}
else
{
//clipboardData.setData('text',clipboardData.getData('text'))
clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))
}
}
else if(navigator.userAgent.indexOf("Opera") != -1)
{
if(isNaN(window.location))
{
//window.location = window.location.replace(/[^\d]/g,'');
window.location = '';
}
}
};
var OnPasteCheckDecimal = function(id)
{
return function()
{
if(window.clipboardData)
{
if(isNaN(window.clipboardData.getData('text') + id.value))
{
clipboardData.setData('text','');
}
&n
Ïà¹ØÎĵµ£º
¶ÔÓÚJavaScriptÀ´½²£¬ËüµÄ³öÏÖʹµÃÐÅÏ¢ºÍÓû§Ö®¼ä²»½öÖ»ÊÇÒ»ÖÖÏÔʾºÍä¯ÀÀµÄ¹ØÏµ£¬¶øÊÇʵÏÖÁËÒ»ÖÖʵʱµÄ¡¢¶¯Ì¬µÄ¡¢¿É½»Ê½µÄ±í´ïÄÜÁ¦¡£×î½üС±àÕûÀíÁËһЩ×ÊÁÏ£¬·¢²¼ÉÏÀ´Óë´ó¼ÒÒ»Æð·ÖÏí£¬Èç¹ûÎÄÕÂÓÐʲô覴û¹Ï£Íû¸ßÊÖÖ¸µã£¬´ó¼ÒÏ໥ѧϰ¡£
JavaScriptÊÇÒ»ÖÖ»ùÓÚ¶ÔÏó(Object)ºÍʼþÇý¶¯(Event Driven)²¢¾ßÓа²È«ÐÔÄܵĽű¾Óï ......
JS×Ô´øº¯Êý
concat
½«Á½¸ö»ò¶à¸ö×Ö·ûµÄÎı¾×éºÏÆðÀ´£¬·µ»ØÒ»¸öеÄ×Ö·û´®¡£
var a = "hello";
var b = ",world";
var c = a.concat(b);
alert(c);
//c = "hello,world"
indexOf
·µ»Ø×Ö·û´®ÖÐÒ»¸ö×Ó´®µÚÒ»´¦³öÏÖµÄË÷Òý£¨´Ó×óµ½ÓÒËÑË÷£©¡£Èç¹ûûÓÐÆ¥ÅäÏ·µ»Ø -1 ¡£
var index1 = a.indexOf("l");
//index1 ......
ÃèÊö event´ú±íʼþµÄ״̬£¬ÀýÈç´¥·¢event¶ÔÏóµÄÔªËØ¡¢Êó±êµÄλÖü°×´Ì¬¡¢°´ÏµļüµÈµÈ¡£ event¶ÔÏóÖ»ÔÚʼþ·¢ÉúµÄ¹ý³ÌÖвÅÓÐЧ¡£ eventµÄijЩÊôÐÔÖ»¶ÔÌØ¶¨µÄʼþÓÐÒâÒå¡£±ÈÈ磬fromElement ºÍ toElement ÊôÐÔÖ»¶Ô onmouseover ºÍ onmouseout ʼþÓÐÒâÒå¡£ Àý×Ó ÏÂÃæµÄÀý×Ó¼ì²éÊó±êÊÇ·ñÔÚÁ´½ÓÉ ......
±¾ÎIJο¼×Ô£ºhttp://www.cnblogs.com/mophee/archive/2009/03/15/1412590.html
¿´µ½Ò»²©¿ÍÀï̽ÌÖjavascript Àï×÷ÓÃÓòµÄÎÊÌâ
Àý×Ó1£º
var tt = 'aa';
function test(){
alert(tt);
var tt = 'dd';
alert(tt);
}
test();
Àý×Ó2£º
var tt = 'aa';
funct ......
<script language="JavaScript" type="text/javascript" >
<!--
.
//-->
</script>
.languageÒѾ±»ÆúÓ㬵«ÎªÁ˼æÈݾɰ汾ä¯ÀÀÆ÷¶ø±£Áô£¬ËùÒÔ½¨ÒéͬʱʹÓÃÕâlanguageºÍtypeÁ½¸ö
.<!--- / ......