JavaScript±à³Ì±Ê¼Ç
ÐÂÖÐ……
1¡¢Êý¾ÝÀàÐÍÑéÖ¤ÎÊÌâ
Asp.NetËäÈ»ÓÐÑéÖ¤¿Ø¼þ£¬µ«ÊÇÓÐЩ¸´ÔÓµÄÑéÖ¤»¹Êǵô«µ½·þÎñÆ÷ÉϽøÐУ¬ÓÃjsËٶȺÍÐÔÄܶ¼±È½ÏºÃ
<script>
//¼ì²éÊÇ·ñΪÈÎÒâÊý£¨ÊµÊý£©
function isNumeric(strNumber) {
var newPar=/^(-|\+)?\d+(\.\d+)?$/
alert(newPar.test(strNumber)); }
//¼ì²éÊÇ·ñΪÕýÊý
function isUnsignedNumeric(strNumber) {
var newPar=/^\d+(\.\d+)?$/
alert(newPar.test(strNumber)); }
//¼ì²éÊÇ·ñΪÕûÊý
function isInteger(strInteger) {
var newPar=/^(-|\+)?\d+$/
alert(newPar.test(strInteger)); }
//¼ì²éÊÇ·ñΪÕýÕûÊý
function isUnsignedInteger(strInteger) {
var newPar=/^\d+$/
alert(newPar.test(strInteger)); }
</script>
2¡¢asp.netÖÐÓÃalert£¨£©ÊµÏÖ»»ÐÐÎÊÌâ
asp.netÖÐÓÃresponse.Write("<script>alert('Ìáʾ£º\n²Ù×÷³ö´í£¡');</script>");ÎÞ·¨Ö´ÐС£
½«×Ö·û´®Ð´³É
say="Ìáʾ£º\\n²Ù×÷³ö´í£¡"
say=@"Ìáʾ£º\n²Ù×÷³ö´í£¡"
3¡¢jsʵÏÖË¢ÐÂÑéÖ¤Âë
µ¥»÷ͼƬˢУº
<img id="CheckImg" src="CreatImage.aspx" onclick="this.src='CreatImage.aspx?temp='+Math.random()"/>
µ¥»÷“Ë¢ÐÂÑéÖ¤Âë”°´Å¥Ë¢ÐÂ
function imagechick()
{
form1.CheckImg.src="CreatImage.aspx?temp="+Math.random();
return false;//²»ÉÏ´«µ½·þÎñÆ÷
}
ÆäÖÐCreatImage.aspxΪ²úÉúÑéÖ¤ÂëͼƬµÄÒ³Ã棬ԴÂë¼û£ºC#²úÉúͼÐÎÑéÖ¤Âë
4¡¢jsÖÐʹÓÃÕýÔò±í´ïʽµÄ·½·¨
¸ñʽÊÇ£º/ÕýÔò±í´ïʽ/
±ØÐëÓÃÁ½¸öб¸Ü°ÑÕýÔò±í´ïʽÀ¨ÆðÀ´¡£
Èç·Ç·¨×Ö·û¼ì²âÕýÔò±í´ïʽΪ£º^(?:[\u4e00-\u9fa5]*\w*\s*)+$
ʹÓõĴúÂëΪ£º
var newPar=/^(?:[\u4e00-\u9fa5]*\w*\s*)+$/;
if(newPar.test("1234&1238*_~"))
{
&
Ïà¹ØÎĵµ£º
µÚÎåÕ Strings and Regular Expressions ×Ö·û´®ºÍÕýÔò±í´ïʽ
Practically all JavaScript programs are intimately tied to strings. For example, many applications use Ajax to fetch strings from a server, convert those strings into more easily usable JavaScript objects, and ......
A Note on Benchmarking ²âÊÔ»ù׼˵Ã÷
Because a regex's performance can be wildly different depending on the text it's applied to, there's no straightforward way to benchmark regexes against each other. For the best result, you need to benchmark your regexes on test strings o ......
µÚ°ËÕ Programming Practices ±à³Ìʵ¼ù
Every programming language has pain points and inefficient patterns that develop over time. The appearance of these traits occurs as people migrate to the language and start pushing its boundaries. Since 2005, when the term "Ajax" ......
Working Around Caching Issues ¹ØÓÚ»º´æÎÊÌâ
Adequate cache control can really enhance the user experience, but it has a downside: when revving up your application, you want to make sure your users get the latest version of the static content. This is accomplished by renaming ......
Summary ×ܽá
When web pages or applications begin to feel slow, analyzing assets as they come over the wire and profiling scripts while they are running allows you to focus your optimization efforts where they are needed most.
µ±ÍøÒ³»òÓ¦ÓóÌÐò±äÂýʱ£¬·ÖÎ ......