最近写了一些关于.net中js操作的通用函数,希望和大家分享 2
2004-05-20 10:58 灵感之源 阅读(1816) 评论(1) 编辑 收藏 举报最近写了一些关于.net中js操作的通用函数,希望和大家分享:
Public Shared Sub ConfirmAndRedirect(ByRef pgeParenet As System.Web.UI.Page, _
ByVal strMessage As String, _
ByVal strTruePage As String, _
ByVal strFalsePage As String)
'名称:ConfirmAndRedirect
'功能:确认,各自转向页面
'作者:chs
'创建:2004/5/20
'修改:2004/5/20
'参数::
' :
'返回:成功,True,反之,False
'说明:
Dim o_strErrMessage As String = "<script language=javascript>if(confirm('"
o_strErrMessage &= strMessage & "')) this.location.replace('"
o_strErrMessage &= strTruePage
o_strErrMessage &= "') else this.location.replace('"
o_strErrMessage &= strFalsePage
o_strErrMessage &= "'); </script>"
pgeParenet.RegisterStartupScript("Message", o_strErrMessage)
End Sub
Public Shared Sub ConfirmAndRunScript(ByRef pgeParenet As System.Web.UI.Page, _
ByVal strMessage As String, _
ByVal strTrueScript As String, _
ByVal strFalseScript As String)
'名称:ConfirmAndRunScript
'功能:确认,各自执行脚本
'作者:chs
'创建:2004/5/20
'修改:2004/5/20
'参数::
' :
'返回:成功,True,反之,False
'说明:
Dim o_strErrMessage As String = "<script language=javascript>if(confirm('"
o_strErrMessage &= strMessage & "')) ("
o_strErrMessage &= strTrueScript
o_strErrMessage &= ") else ("
o_strErrMessage &= strFalseScript
o_strErrMessage &= "); </script>"
pgeParenet.RegisterStartupScript("Message", o_strErrMessage)
End Sub