确认消息框,但在onclick触发后 [英] confirm messagebox, but after onclick firing
问题描述
我可以在页面创建期间创建Javascript确认消息框等
将它们添加到按钮属性(关于此的很多好帖子!)。但是如何在按下按钮后添加此事件
我创建了一个Is_Dirty例程检查我的页面上的字段更改
然后,如果用户点击退出按钮,则按钮我检查Is_Dirty = true和
想要询问你想退出而不保存吗?。这是一个代码
,如果Is_Dirty = True,那么我想显示消息框
并返回确认。因此,如果用户点击取消,然后他们回到了
表格。
我试过了:
1.)但是返回不能用在前面确认,我收到错误,但
无需确认即可工作。
Dim popupScript As String ="< script language =''javascript''>" &安培; _
"确认("你确定要退出而不保存
更改吗?");" &安培; _
"< / script>"
Response.Write(popupScript)
有什么想法吗? thanx。
我会在ok按钮的onclick事件中尝试if语句,并且
真正的部分if语句,我会插入
page.getpostbackeventreference ....
听起来怎么样?
< blockquote>取消按钮是CausesValidation =False" "所以没有回帖。我这样做是为了处理页面验证,从而删除它。
所以我认为有一种方法可以把它放在流中吗? HTML流媒体?
是否有其他页面属性可供访问?
因为我可以插入确认但没有返回?随着回报我得到了
" return statement of of function" Javascript页面错误??????
thanx。
" vbMental"写道:
我会在ok按钮的onclick事件中尝试一个if语句,并且对于
if语句的真实部分,我会插入
page.getpostbackeventreference ....
听起来怎么样?
如何在客户端实现Is_Dirty?
>
Eliyahu
" Chris" <章*** @ discussions.microsoft.com>在留言中写道
新闻:AE ********************************** @ microsof t.com ...我可以在页面创建期间创建Javascript确认消息框等等
将它们添加到按钮属性(很多好帖子!)。但是按下按钮后我可以如何
添加这个事件?
我创建了一个Is_Dirty例程来检查我页面上的字段更改
然后如果用户点击退出按钮按钮我检查Is_Dirty = true
然后想要询问你想退出而不保存吗?。这是一个代码背后
如果Is_Dirty = True的值那么我想显示带有return confirm的
消息框。因此,如果用户点击取消,然后他们回到了
的表格。
我试过了:
1。)但是返回不能在确认前使用,我收到错误,但是
无需确认即可工作。
Dim popupScript As String ="< script language =''javascript''>" &安培; _
"确认("你确定要退出而不保存
更改吗?");" &安培; _
"< / script>"
Response.Write(popupScript)
任何想法? thanx。
I can create Javascript confirm message boxes during page creation, etc
adding them to the button attributes (many good posts on this!). But how can
I add this event after the button is pressed?
I have created an Is_Dirty routine checking for field changes on my page
then if the user clicks on the "exit" button I check for Is_Dirty = true and
want to ask then "do you want to exit without saving?". It''s a code behind
where if the value of Is_Dirty = True then I want to display the messagebox
with return confirm. So if the user clicks "cancel" then they are back on the
form.
I''ve tried:
1.) But return can not be used in front of confirm, I get an error, but
works without confirm.
Dim popupScript As String = "<script language=''javascript''>" & _
"confirm(""Are you sure you want to exit without saving
changes?"");" & _
"</script>"
Response.Write(popupScript)
Any ideas? thanx.
I would try an if statement inside the onclick event of the ok button and for
the true part of the if statement, I would insert the
page.getpostbackeventreference ....
How does that sound?
The cancel button is "CausesValidation="False" " so there is no post back. I
do this to handle the page validation, thus, removing it.
So I thought there was a way to put it in the stream somehow? HTML Stream?
Is there another page property to access for this?
As I can insert the confirm but without the return? With the return I get
"return statement out of function" Javascript page error??????
thanx.
"vbMental" wrote:
I would try an if statement inside the onclick event of the ok button and for
the true part of the if statement, I would insert the
page.getpostbackeventreference ....
How does that sound?
What about implementing Is_Dirty on client side?
Eliyahu
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...I can create Javascript confirm message boxes during page creation, etc
adding them to the button attributes (many good posts on this!). But how can I add this event after the button is pressed?
I have created an Is_Dirty routine checking for field changes on my page
then if the user clicks on the "exit" button I check for Is_Dirty = true and want to ask then "do you want to exit without saving?". It''s a code behind
where if the value of Is_Dirty = True then I want to display the messagebox with return confirm. So if the user clicks "cancel" then they are back on the form.
I''ve tried:
1.) But return can not be used in front of confirm, I get an error, but
works without confirm.
Dim popupScript As String = "<script language=''javascript''>" & _
"confirm(""Are you sure you want to exit without saving
changes?"");" & _
"</script>"
Response.Write(popupScript)
Any ideas? thanx.
这篇关于确认消息框,但在onclick触发后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!