Javascript »ñÈ¡Ò³ÃæÉÏÑ¡ÖеÄÎÄ×Ö
IE¿ÉÒÔµ÷Óãº
<script type="text/javascript">
// ˵Ã÷£º»ñÈ¡Ò³ÃæÉÏÑ¡ÖеÄÎÄ×Ö
// ÕûÀí£ºhttp://www.CodeBit.cn
function getSelectedText() {
if (window.getSelection) {
// This technique is the most likely to be standardized.
// getSelection() returns a Selection object, which we do not document.
return window.getSelection().toString();
}
else if (document.getSelection) {
// This is an older, simpler technique that returns a string
return document.getSelection();
}
else if (document.selection) {
// This is the IE-specific technique.
// We do not document the IE selection property or TextRange objects.
return document.selection.createRange().text;
}
}
</script>
ÔÚ FireFox Ï»ñÈ¡ input »òÕß textarea ÖÐÑ¡ÖеÄÎÄ×Ö£¬¿ÉÒÔÓÃÏÂÃæµÄ·½·¨£º
<script type="text/javascript">
// ˵Ã÷£ºFireFox Ï»ñÈ¡ input »òÕß textarea ÖÐÑ¡ÖеÄÎÄ×Ö
// ÕûÀí£ºhttp://www.codebit.cn
function getTextFieldSelection(e) {
if (e.selectionStart != undefined && e.selectionEnd != undefined) {
var start = e.selectionStart;
var end = e.selectionEnd;
return e.value.substring(start, end);
}
else return ""; // Not supported on this browser
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD
Ïà¹ØÎĵµ£º
ɾ³ýÐÐ
<script>
function del(obj)
{
obj.parentNode.parentNode.removeNode(true);
}
</script>
<body& ......
reg = /^((((((0[48])|([13579][26])|([2468][048]))00)|([0-9][0-9]((0[48])|([13579][26])|([2468][048]))))-02-29)|(((000[1-9])|(00[1-9][0-9])|(0[1-9][0-9][0-9])|([1-9][0-9][0-9][0-9]))-((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30))|(((0[1-9])|(1[0-2]))-((0[1-9])|(1[0-9])|(2[0-8]))))))$/i; ......
ÔÚjavascriptº¯ÊýÌåÄÚ£¬±êʶ·ûarguments¾ßÓÐÌØÊ⺬Òå¡£ËüÊǵ÷ÓöÔÏóµÄÒ»¸öÌØÊâÊôÐÔ£¬ÓÃÀ´ÒýÓÃArguments¶ÔÏó¡£Arugments¶ÔÏó¾ÍÏñÊý×飬עÒâÕâÀïÖ»ÊÇÏñ²¢²»Êǹþ¡£
javascriptº¯ÊýÌåÄÚ£¬argumentsÏñÊý×é(²¢²»ÊÇÕæµÄÊý×飬ÊÇÒ»¸öArguments¶ÔÏó£¬ÔÙ´ÎÇ¿µ÷)Ò»Ñù£¬ÓÐlengthÊôÐÔ£¬¿ÉÒÔ´ú±í´«¸øº¯ÊýµÄ²ÎÊýµÄ¸öÊý¡£
ÒýÓÃÒ»¸öÐÎʽ² ......
Definition and Usage
¶¨ÒåÓëÓ÷¨The constructor property is a reference to the function that created an object.
constructorÊôÐÔÊÇËù½¨Á¢¶ÔÏóµÄº¯Êý²Î¿¼Syntax
Óï·¨object.constructor
Example 1
¾ÙÀý
In this example we will show how to use the constructor property:
ÔÚÕâ¸ö¾ÙÀýÖÐÎÒÃǽ«Õ¹Ê¾ÈçºÎʹÓÃcons ......