JavaScript ÖÆ×÷¼òµ¥¼ÆËãÆ÷ isNaN eval ʹÓÃ
Åжϣ¨value£©ÊÇ·ñÊÇÒ»¸öÊý×Ö£¬¼ÙÈçÖµÊÇNaNÄÇôIsNan·µ»ØTRUE£¬·ñÔò·µ»ØFALSE¡£
»¹ÓÐÒ»ÖÖ°ì·¨£¬±äÁ¿¿ÉÒÔÓëËü×ÔÉí½øÐбȽϡ£ ¼ÙÈç±È½ÏµÄ½á¹û²»µÈ£¬ÄÇôËü¾ÍÊÇ NaN ¡£
ÕâÊÇÒòΪ NaN ÊÇΨһÓë×ÔÉí²»µÈµÄÖµ¡£
µÚÒ»ÖÖ·½·¨£º
<html>
<head>
<title>¼òµ¥¼ÆËãÆ÷µÄÖÆ×÷</title>
</head>
<mce:script language="JavaScript"><!--
function say(){
var one = parseInt(document.getElementById("one").value);//½«Îı¾ÄÚÈÝת»»ÊýÖµ
var two = parseInt(document.getElementById("two").value);
var flag = document.getElementById("flag").value;
if(isNaN(one)){ //isNanÅжÏÊÇ·ñΪÊý×Ö
alert('ÇëÊäÈëÊý×Ö');
}else if(isNaN(two)){
alert('ÇëÊäÈëÊý×Ö');
}else{
var sum = 0;
switch(flag){
case "+":
sum = one + two;
break;
case "-":
sum = one - two;
break;
case "*":
sum = one * two;
break;
case "/":
sum = one / two;
break;
}
document.getElementById("result").innerHTML = "<font color=red>" + sum + "</font>"
}
}
<body>
<input type="text" name="one" id="one">
<select name="flag" id="flag">
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
<input type="text" name="two" id="two">
<input type="button" value="=" onClick="say()">
<!--
<input type="text" name="result" id="result">
-->
<span id="result"></span>
</body>
</html>
<html>
<head>
<title>¼òµ¥¼ÆËãÆ÷µÄÖÆ×÷</title>
</head>
<mce:script language="JavaScript"><!--
function say(){
var one = parseInt(document
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
1.³öÓÚ°²È«¿¼ÂÇ£¬JavaScriptÖÐÖ»Óпª·¢Õß×Ô¶¨ÒåµÄÀà¿ÉÒÔ±»¼Ì³Ð¡£
2.ʹÓöÔÏóð³äʵÏּ̳Ð
function ClassA(sColor){
this.color=sColor;
this.showColor=function (){
&nbs ......
This document is for establishing build standard for JavaScript and CSS compression
The objective for this document is to establish a companywide JavaScript and CSS compression standard that can be shared crossing multiple SharePoint product development projects. This is the first draft
Overview ......
ÎÒ»¹ÊDzËÄñ£¬Çë´ó¼Ò¶àÖ¸½Ì£¡
Ò³ÃæÒ»£º
<html>
<head>
<title> Ò³Ãæ´«ÖµÒ» </title>
<script>
function funShow()
{
var arr=new Array(6);
var arrs = showModalDialog("Ò³ ......
Ò³ÃæÒ»£º
<html>
<head>
<title> ÑéÖ¤ÓëÌá½»Ò» </title>
<script>
function focusSelect(ID) //µ±ÑéÖ¤²»ÄÜͨ¹ýʱ»ñµÃÑéÖ¤¿Ø¼þµÄ½¹µãºÍÄÚÈÝ
{
document.getElementById(I ......