³£ÓÃJavaScriptÅжÏ×Ö·û´®µÄһЩ´úÂë
//ÅжÏÊäÈëÄÚÈÝÊÇ·ñΪ¿Õ
function IsNull(){
var str = document.getElementById('str').value.trim();
if(str.length==0){
alert('¶Ô²»Æð£¬Îı¾¿ò²»ÄÜΪ¿Õ»òÕßΪ¿Õ¸ñ!');//Ç뽫“Îı¾¿ò”¸Ä³ÉÄãÐèÒªÑéÖ¤µÄÊôÐÔÃû³Æ!
}
}
//ÅжÏÈÕÆÚÀàÐÍÊÇ·ñΪYYYY-MM-DD¸ñʽµÄÀàÐÍ
function IsDate(){
var str = document.getElementById('str').value.trim();
if(str.length!=0){
var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;
var r = str.match(reg);
if(r==null)
alert('¶Ô²»Æð£¬ÄúÊäÈëµÄÈÕÆÚ¸ñʽ²»ÕýÈ·!'); //Ç뽫“ÈÕÆÚ”¸Ä³ÉÄãÐèÒªÑéÖ¤µÄÊôÐÔÃû³Æ!
}
}
//ÅжÏÈÕÆÚÀàÐÍÊÇ·ñΪYYYY-MM-DD hh:mm:ss¸ñʽµÄÀàÐÍ
function IsDateTime(){
var str = document.getElementById('str').value.trim();
if(str.length!=0){
var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;
var r = str.match(reg);
if(r==null)
alert('¶Ô²»Æð£¬ÄúÊäÈëµÄÈÕÆÚ¸ñʽ²»ÕýÈ·!'); //Ç뽫“ÈÕÆÚ”¸Ä³ÉÄãÐèÒªÑéÖ¤µÄÊôÐÔÃû³Æ!
}
}
//ÅжÏÈÕÆÚÀàÐÍÊÇ·ñΪhh:mm:ss¸ñʽµÄÀàÐÍ
function IsTime()
{
var str = document.getElementById('str').value.trim();
if(str.length!=0){
reg=/^((20|21|22|23|[0-1]\d)\:[0-5][0-9])(\:[0-5][0-9])?$/
if(!reg.test(str)){
alert("¶Ô²»Æð£¬ÄúÊäÈëµÄÈÕÆÚ¸ñʽ²»ÕýÈ·!");//Ç뽫“ÈÕÆÚ”¸Ä³ÉÄãÐèÒªÑéÖ¤µÄÊôÐÔÃû³Æ!
}
}
}
//ÅжÏÊäÈëµÄ×Ö·ûÊÇ·ñΪӢÎÄ×Öĸ
function IsLetter()
{
var str = document.getElementById('str').value.trim();
if(str.length!=0){
reg=/^[a-zA-Z]+$/;
if(!reg.test(str)){
alert("¶Ô²»Æð£¬ÄúÊäÈëµÄÓ¢ÎÄ×ÖĸÀàÐ͸ñʽ²»ÕýÈ·!");//Ç뽫“Ó¢ÎÄ×ÖĸÀàÐÍ”¸Ä³ÉÄãÐèÒªÑéÖ¤µÄÊôÐÔÃû³Æ!
}
}
}
//ÅжÏÊä
Ïà¹ØÎĵµ£º
½üÀ´¿´ÁËDeanµÄ“Convert any colour value to hex in MSIE”£¬ÖÕÓÚ½â¾öÁ˸ù¾Ý¹Ø¼ü×Ö»ñÈ¡ÑÕÉ«rgbÖµµÄÎÊÌâ¡£
˳±ã°Ñ³ÌÐòÒ²ÖØÐÂÕûÀíÒ»·¬£¬²¢Ê¹ÓÃÁË×î½üÕûÀíµÄ¹¤¾ß¿â¡£
Ч¹ûÔ¤ÀÀµ½ÕâÀï
ÏÂÔØÍêÕûʵÀý
³ÌÐò˵Ã÷
¡¾ColorGradsÑÕÉ«Ìݶȡ¿
³ÌÐòColorGradsµÄ×÷ÓÃÊǸù¾ÝÑÕÉ«¼¯ºÏºÍ½¥±ä¼¶ÊýÉú³ÉÑÕÉ«Ìݶȼ¯ºÏ¡£
½¥±ä¼ ......
JavascriptÖÐ×î³£ÓõÄ55¸ö¾µä¼¼ÇÉ ÊÕ²Ø
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4 ......
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>ÎÞ±êÌâÒ³</title>
<mce:script language="javascript" type="te ......
ÔÚJavaScriptÖÐûÓÐרÃŵĻúÖÆÀ´ÊµÏÖÀàµÄ¼Ì³Ð£¬µ«ÊÇ¿ÉÒÔͨ¹ý¿½±´Ò»¸öÀàµÄprototypeµ½ÁíÍâÒ»¸öÀàÀ´ÊµÏּ̳У¬Ò»ÖÖ¼òµ¥µÄʵÏÖÈçÏ£º
function class1(){
}
function class2(){
}
class2.prototype=class1.prototype;
class2.prototype.moreProperty="xxx";
class2.prototype.moreMethod1=function(){
}
var obj = ne ......
ѧϰÁ˽âÁËjavascriptµÄһЩԪËضÔÏóµÄ´´½¨£¬»ñÈ¡µÈ¡£ÏÖÔÚµÄѧϰÖ÷ÒªÊÇÉæ¼°ÔÚ±àдjavascriptµ±ÖÐÓ¦¸Ã×¢ÒâµÄһЩϸ½Ú£º
1 ×¢Òâ±äÁ¿µÄ±àдÕýÈ·
2 ²ÎÊý´«µÝ³öÏÖÎÊÌâ »òÕß²»´æÔÚÒ²»áµ¼Ö³ö´í
3 js´íÎóµÄ¿ØÖƺ¯Êý window.onerror£ºÆ佫»á´øÈý¸ö²ÎÊýÐÅÏ¢ ¿Éͨ¹ý²ÎÊýÊý×é arguments »ñÈ¡ÐÅÏ¢ ´íÎóÐÅÏ¢£¬´íÎóÒ³ÃæµÄurlºÍ´í ......