国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 永清县| 尚义县| 河池市| 普洱| 平山县| 锡林浩特市| 平凉市| 公安县| 德江县| 长乐市| 中牟县| 湘乡市| 蓬溪县| 五指山市| 新宾| 贡觉县| 盐城市| 瑞丽市| 抚远县| 岗巴县| 张家港市| 高台县| 怀柔区| 重庆市| 丹巴县| 吉木萨尔县| 淮南市| 吉安县| 宜良县| 遵义市| 宜宾县| 舞阳县| 盘锦市| 沿河| 隆德县| 海南省| 荣昌县| 富锦市| 仪征市| 清河县| 河西区|