如何解決-2-10的問(wèn)題
<!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>自定義類級(jí)別插件</title>
? ? ? ? <link href="style.css" rel="stylesheet" type="text/css" />
? ? ? ? <script type="text/javascript" src="http://idcbgp.cn/data/jquery-1.8.2.min.js"></script>
? ? ? ? <script src="http://idcbgp.cn/data/jquery.twoaddresult.js" type="text/javascript"></script>
? ? </head>
? ??
? ? <body>
? ? ? ? <div id="divtest">
? ? ? ? ? ? <div class="title">
? ? ? ? ? ? ? ? <span class="fl">自定義類級(jí)別插件</span>?
? ? ? ? ? ? ? ? <span class="fr">
? ? ? ? ? ? ? ? ? ? <input id="btnCount" type="button" value="計(jì)算" />
? ? ? ? ? ? ? ? </span>
? ? ? ? ? ? </div>
? ? ? ? ? ? <div class="content">
? ? ? ? ? ? ? ? 兩數(shù)相減:
? ? ? ? ? ? ? ? <input id="Text1" type="text" class="txt" />
? ? ? ? ? ? ? ? -
? ? ? ? ? ? ? ? <input id="Text2" type="text" class="txt" />
? ? ? ? ? ? ? ? =
? ? ? ? ? ? ? ? <input id="Text3" type="text" class="txt" />
? ? ? ? ? ? </div>
? ? ? ? </div>
? ? ? ??
<script type="text/javascript">
? ? $(function () {
? ? ? ? $("#btnCount").bind("click", function () {
? ? ? ? ? ? $("#Text3").val(
? ? ? ? ? ? ? ?$.subNum($("#Text1").val(),$("#Text2").val())
);
? ? ? ? });
? ? });
</script>
? ? </body>
</html>
2016-03-01
這個(gè)是插件沒(méi)寫好的原因,你可以直接用?$("#Text3").val( $("#Text1").val() - $("#Text2").val()); ?不用他們給的這個(gè)插件函數(shù)就可以了,但需要完善下判定輸入值是否為空或者是否為數(shù)值