正文

记录我学习ASP For AJAX的旅程二2007-09-21 15:46:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/goalbell/29575.html

分享到:

记录我学习ASP For AJAX的旅程,做了一个简单的发布留言的功能,但是体验性不错。 <!--#include file="../ajaxed.asp"--><%'实例化对象pset p=new ajaxedPage '打开数据库连接p.DBConnection=true '加载整个页面p.draw() '初始化页面sub init():end sub sub callback(action)   if action = "do" then       p.return(dos(p.RF("tle"),p.RF("uname"),p.RF("mal"),p.RF("ste"),p.RF("cent")))    end ifend sub function dos(tle,uname,mal,ste,cent)       if Not p.RFHas("tle")  then       lib.error("Please check the toic!")  elseif Not p.RFHas("uname") then       lib.error("Please check the name!")  elseif Not str.isValidEmail(mal) or Not p.RFHas("mal")  then        lib.error("Please check the email!")  elseif  Not str.isValidHomepage(ste) or Not p.RFHas("ste") then       lib.error("Please check the website!")  elseif Not P.RFHas("cent") then     lib.error("Please check the content!") else          dos = db.getRecordset("Insert Into [messbook](topic,name,mail,site,IP,content)values('"& tle & "','" & uname & "','" & mal & "','" & ste & "','" & request.ServerVariables("REMOTE_ADDR") & "','" & cent & "')")    end if end function sub main()%> <script language="javascript" type="text/javascript">   function done()   {      $("showinfo").innerHTML="inserted Successfully !";    } </script>   <form id="frm">   <fieldset style="width:390px;">   <legend>Leave a  Reply</legend><span>Your topic:<input  type="text" id="tle" name="tle" /></span><span style="color:#AA1F00;">*(required)</span><br /><br />     <span>Your name:<input  type="text" id="uname" name="uname" /></span><span style="color:#AA1F00;">*(required)</span><br /><br />      <span>Your mail:<input  type="text" id="mal" name="mal" /></span><span style="color:#AA1F00;">*(required)</span><br /><br />      <span>Your website:<input  type="text" id="ste" name="ste" /></span><span style="color:#AA1F00;">*(required)</span><br /><br />       <span>Your content:<br /><textarea cols="36" rows="10" name="cent" id="cent"></textarea></span><span style="color:#AA1F00;">*(required)</span><br /><br />              <div id="showinfo"></div>       <span><button onClick="ajaxed.callback('do',done)" type="button">Submit Comment</button>  </span>  </fieldset> </form> <%db.close()end sub%>

阅读(2647) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册