您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 如何实现web页面的提示保存功能
  所属分类: Javascript
  开发工具:
  文件大小: 8kb
  下载次数: 0
  上传时间: 2006-02-23
  提 供 者: che***
 详细说明: 每每听到客户抱怨自己修改和很久的数据由于自己的一个误操作而丢失时,总想让web页面也有像window窗体一样具有提示保存的功能。所以,经过一段时间的研究以后终于实现了这个功能!============ checksave.js =============================== test.aspx ===============<%@ Page Language="vb" AutoEventWireup="false" Codebehind="test.aspx.vb" Inherits="Test.test" smartNavigation="True" %> test
sohu
yahoo
MTR LinkButton
======== test.aspx.vb ===============Public Class test Inherits System.Web.UI.Page Protected WithEvents txtSave As System.Web.UI.WebControls.TextBox Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton Protected WithEvents Button1 As System.Web.UI.WebControls.Button Protected WithEvents txtCheckFlag As System.Web.UI.WebControls.TextBox#Region " Web Form Designer Generated Code " ‘This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init ‘CODEGEN: This method call is required by the Web Form Designer ‘Do not modify it using the code editor. InitializeComponent() End Sub#End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ‘Put user code to initialize the page here txtSave.Style.Item("display") = "none" txtCheckFlag.Style.Item("display") = "none" LinkButton1.Attributes("onclick") = "javascript:return checksave(this.href)" ‘ Page.RegisterStartupScript("Prompt", "") End Sub Private Sub txtCheckFlag_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCheckFlag.TextChanged Session("URL") = txtCheckFlag.Text If checkdata() Then ‘Session("Data") = Me.Data If InStr(txtCheckFlag.Text, "__doPostBack") > 0 Then Page.RegisterStartupScript("warning", "") Else Page.RegisterStartupScript("warning", "") End If Else If InStr(txtCheckFlag.Text, "__doPostBack") > 0 Then Session("URL") = Replace(txtCheckFlag.Text, "javascript:", "") Page.RegisterStartupScript("warning", "") Else If InStr(txtCheckFlag.Text, "javascript:") > 0 Then Session("URL") = Replace(txtCheckFlag.Text, "javascript:", "") Page.RegisterStartupScript("Redirect", "") Else Page.RegisterStartupScript("Redirect", "") Response.End() End If End If End If End Sub Private Sub txtSave_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSave.TextChanged If savedata() = False Then txtSave.Text = "" txtCheckFlag.Text = "" Exit Sub End If Me.ViewState("flag") = True If InStr(txtCheckFlag.Text, "__doPostBack") > 0 Then Page.RegisterStartupScript("TxtSave", "") Else If InStr(txtCheckFlag.Text, "javascript:") > 0 Then Session("URL") = Replace(txtCheckFlag.Text, "javascript:", "") Page.RegisterStartupScript("TxtSave", "") Else Page.RegisterStartupScript("Redirect", "") ‘Response.Redirect(Session("URL")) ‘Response.End() End If End If txtSave.Text = "" txtCheckFlag.Text = "" End Sub Private Function checkdata() As Boolean ‘check whether user really had modified the data Return True End Function Private Function savedata() As Boolean ‘do save data here! Return True End Function Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click If Me.ViewState("flag") = True Then Page.RegisterStartupScript("Redict", "") Else Page.RegisterStartupScript("Redict", "") End If End SubEnd Class ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: ASP.Net 控件 源码 资源
 输入关键字,在本站1000多万海量源码库中尽情搜索: