欢迎光临
我们一直在努力

webservice结合dhtml的简单例子(三,漏贴一个文件,呵呵)-.NET教程,Web Service开发

建站超值云服务器,限时71元/月

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必须是数字") ;
            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("格式错误") ;
                            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>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » webservice结合dhtml的简单例子(三,漏贴一个文件,呵呵)-.NET教程,Web Service开发
分享到: 更多 (0)