国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

webservice結(jié)合dhtml的簡單例子(三,漏貼一個(gè)文件,呵呵)

2024-08-26 00:15:33
字體:
供稿:網(wǎng)友

file demo.html

<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
    <head>
        <meta name="generator" content="microsoft visual studio 7.0">
        <title></title>
    </head>
    <script language="javascript">
      function onload()
      {
        var str = window.dialogarguments ;
        if(str != undefined)
        {
          var arr = str.split("-") ;
          if(arr.length == 2)
          {
            frmmain.txtname.value = arr[0] ;
            frmmain.txtamount.value = arr[1] ;
          }
        }
        
      }
      function onsubmit()
      {
        if(frmmain.txtname.value == "" || frmmain.txtamount.value == "")
        {
            alert("都要填") ;
            return false ;
        }
        else if(!isdigit(frmmain.txtamount.value))
        {
            alert("amount必須是數(shù)字") ;
            frmmain.txtamount.focus() ;
            frmmain.txtamount.select() ;
            return false ;
        }
        else
        {
            var odemo = new demo(frmmain.txtname.value , frmmain.txtamount.value) ;
            window.returnvalue = odemo ;
            window.close() ;
        }
      }
      
      function demo(name , amount)
      {
        this.name = name ;
        this.amount = amount ;
        this.tostring = function()
                        {
                            return this.name + "-" + this.amount ;
                        };
        this.fromstring = function(str)
                        {
                           var arr =  str.split("-") ;
                           if(str == "")
                           {
                            this.name = "" ;
                            this.amount = 0 ;
                           }
                           else if(arr.length == 2)
                           {
                             this.name = arr[0] ;
                             this.amount = arr[1] ;
                           }
                           else
                           {
                            alert("格式錯(cuò)誤") ;
                            return false ;
                           }
                        };
                        
      }
      
      function isdigit(str)
      {
        for(var i = 0 ; i < str.length ; i ++)
        {
            var ch = str.charat(i) ;
            if(ch < '0' || ch > '9')
            {
              return false ;
            }
        }
        
        return true ;
      }
    </script>
    <body onload="onload()">
        <form name="frmmain">
            <table width="200" align="center">
                <tr>
                    <td width="50">name:</td>
                    <td><input type="text" name="txtname" size="10"></td>
                </tr>
                <tr>
                    <td width="50">amount:</td>
                    <td><input type="text" name="txtamount" size="10"></td>
                </tr>
                <tr>
                    <td align="center"><input type="button" onclick="onsubmit()" value="確定"></td>
                </tr>
            </table>
        </form>
    </body>
</html>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 久治县| 襄樊市| 杂多县| 萍乡市| 蛟河市| 天柱县| 调兵山市| 凤冈县| 肇东市| 临夏市| 珲春市| 克拉玛依市| 朝阳县| 石狮市| 太仆寺旗| 正宁县| 夏河县| 依安县| 垣曲县| 甘肃省| 井研县| 岱山县| 洛南县| 开封县| 南召县| 泽州县| 伊宁县| 明溪县| 孝感市| 休宁县| 余姚市| 龙口市| 焉耆| 响水县| 彰化县| 济源市| 舟曲县| 滦南县| 大宁县| 尤溪县| 济南市|