脚本警报窗口未打开 [英] script alert window not open

查看:59
本文介绍了脚本警报窗口未打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim strmessageEdit As String
             strmessageEdit = "Record Deleted Successfully"
             Dim strScriptEdit As String = "<script runat=server language=JavaScript>alert('" & strmessageEdit & "');</script>"
             Page.RegisterStartupScript("clientScript", strScriptEdit)
             Response.Redirect("Add.aspx")



记录成功删除"脚本窗口未打开,它调用打开的ass.aspx页,我想向用户显示记录成功删除"消息.
并重定向到Add.aspx页面,



"Record Deleted Successfully" script window not open , it call open ass.aspx page, i want show "Record Deleted Successfully " message to user.
and redirect to Add.aspx page,

how it is possible?

推荐答案

由于Response.Redirect调用,警报将永远不会显示.
为此,请使用JavaScript中的window.location在警报后重定向页面,并注释掉对Response.Redirect的调用.

The alert will never display because of the Response.Redirect call.

To make this work, use window.location in JavaScript to redirect the page after the alert and comment out the call to Response.Redirect.

Dim strmessageEdit As String
    strmessageEdit = "Record Deleted Successfully"
Dim strScriptEdit As String = _
  "<script runat=""server"" language=""JavaScript"">alert('" & _
  strmessageEdit & _
  "'); window.location = '" &
  Page.ResolveUrl("~/Add.aspx") & _
  "';</script>"
Page.RegisterStartupScript("clientScript", strScriptEdit)
'Response.Redirect("Add.aspx")


我不认为这在您实现的方法中是可行的.理想情况下,它将运行整个功能(您的VB代码),然后调用Javascript.
如果要执行此类操作,我将保存数据,然后调用JS函数,显示警报,然后使用__dopostback.
I do not think so it is feasible in the approach you are implementing. Ideally, it would run the entire function (your VB Code) and then call the Javascript.
If you want to do this type of operation, I would save the data and then call the JS Function, display the alert and then use __dopostback.


尝试:
Dim strScriptEdit As String =<脚本语言=''Javascript"> alert(``''& strmessageEdit&''));</script>"
Try:
Dim strScriptEdit As String = "<script language = ''Javascript'' >alert(''" & strmessageEdit & "'');</script>"


这篇关于脚本警报窗口未打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆