Javascript无法正常工作 [英] Javascript not working

查看:85
本文介绍了Javascript无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码将Javascript确认框附加到我的

复选框。当我选中复选框时,窗口显示正常,但是当我按下是按钮时,它不会执行XfertoDefault_Click功能。

如果我取消Javascript事件,复选框工作正常。


XferToDefault.Attributes.Add(" onclick"," return confirm(''你确定你是否要
想复制这些条目?'');")


< asp:CheckBox ID =" XferToDefault" AutoPostBack =" true"
OnCheckedChanged =" XferToDefault_Click" runat =" server" />


如果我将复选框更改为ImageButton,一切正常 -

Javascript窗口以及去按下按钮后按下该功能。

< asp:ImageButton ID =" XferToDefault" OnClick =" XferToDefault_Click"

ImageUrl =" ../../ buttons / xfer.gif" runat =" server" />


为什么复选框(或单选按钮)不起作用?


谢谢,


Tom

I have the following code that attaches a Javascript confirm box to my
checkbox. When I select the checkbox, the window comes up fine, but it
never executes the XfertoDefault_Click function when I press the Yes button.
If I take off the Javascript event, the checkbox works fine.

XferToDefault.Attributes.Add("onclick", "return confirm(''Are you sure you
want copy these entries?'');")

<asp:CheckBox ID="XferToDefault" AutoPostBack="true"
OnCheckedChanged="XferToDefault_Click" runat="server"/>

If I change the checkbox to an ImageButton, it all works fine - the
Javascript window as well as going to the function after the Yes button is
pressed.
<asp:ImageButton ID="XferToDefault" OnClick="XferToDefault_Click"
ImageUrl="../../buttons/xfer.gif" runat="server"/>

Why doesn''t the checkbox (or radiobutton) work?

Thanks,

Tom

推荐答案

Tom,


试试


XferToDefault.Attributes.Add(" onclick"," if(!confirm(''你确定要

复制这些条目吗?'')return ;")


如果有效,我可以解释原因。

Eliyahu


tshad< tf*@dslextreme.com>写在消息中

news:%2 **************** @ TK2MSFTNGP09.phx。 gbl ...
Tom,

Try

XferToDefault.Attributes.Add("onclick", "if(!confirm(''Are you sure you want
copy these entries?'')return;")

If it works, I can explain the reason.

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
我有以下代码将Javascript确认框附加到我的
复选框。当我选中复选框时,窗口显示正常,但它从来没有当我按下Yes
按钮时执行XfertoDefault_Click功能。如果我取消Javascript事件,该复选框工作正常。

XferToDefault.Attributes.Add(" on点击,返回确认(''你确定要复制这些条目吗?');")

< asp:CheckBox ID =" XferToDefault" AutoPostBack =" true"
OnCheckedChanged =" XferToDefault_Click" runat =" server" />

如果我将复选框更改为ImageButton,它一切正常 -
Javascript窗口以及在Yes按钮后转到该功能
紧迫。
< asp:ImageButton ID =" XferToDefault" OnClick =" XferToDefault_Click"
ImageUrl =" ../../ buttons / xfer.gif" runat =" server" />

为什么复选框(或单选按钮)不起作用?

谢谢,

Tom
I have the following code that attaches a Javascript confirm box to my
checkbox. When I select the checkbox, the window comes up fine, but it
never executes the XfertoDefault_Click function when I press the Yes button. If I take off the Javascript event, the checkbox works fine.

XferToDefault.Attributes.Add("onclick", "return confirm(''Are you sure you
want copy these entries?'');")

<asp:CheckBox ID="XferToDefault" AutoPostBack="true"
OnCheckedChanged="XferToDefault_Click" runat="server"/>

If I change the checkbox to an ImageButton, it all works fine - the
Javascript window as well as going to the function after the Yes button is
pressed.
<asp:ImageButton ID="XferToDefault" OnClick="XferToDefault_Click"
ImageUrl="../../buttons/xfer.gif" runat="server"/>

Why doesn''t the checkbox (or radiobutton) work?

Thanks,

Tom



" Eliyahu Goldin" <再************* @ monarchmed.com>在消息中写道

news:ui ************** @ tk2msftngp13.phx.gbl ...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
Tom,
尝试

XferToDefault.Attributes.Add(" onclick"," if(!confirm(''你确定你要
想要复制这些条目吗?'')返回;")


我试过了,但Javascript一定有问题。我根本没有得到

确认框现在,以及不去功能。


Tom

如果有效,我可以解释一下原因。
Eliyahu

" tshad"< tf*@dslextreme.com>在留言中写道
新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
Tom,

Try

XferToDefault.Attributes.Add("onclick", "if(!confirm(''Are you sure you want copy these entries?'')return;")
I tried that, but there must be a problem with the Javascript. I don''t get
the confirm box at all now, as well as not going to the function.

Tom

If it works, I can explain the reason.

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
我有以下代码将Javascript确认框附加到我的
复选框。当我选中该复选框时,窗口显示正常,但它<当我按下是
I have the following code that attaches a Javascript confirm box to my
checkbox. When I select the checkbox, the window comes up fine, but it
never executes the XfertoDefault_Click function when I press the Yes


按钮时,从不执行XfertoDefault_Click功能。


button.

如果我没有关闭Javascript事件,该复选框工作正常。

XferToDefault.Attributes.Add(" onclick"," return confirm(''你确定
你想复制这些条目吗? '');")

< asp:CheckBox ID =" XferToDefault" AutoPostBack =" true"
OnCheckedChanged =" XferToDefault_Click" runat =" server" />

如果我将复选框更改为ImageButton,它一切正常 -
Javascript窗口以及在Yes按钮后转到该功能
被按下。
< asp:ImageButton ID =" XferToDefault" OnClick =" XferToDefault_Click"
ImageUrl =" ../../ buttons / xfer.gif" runat =" server" />

为什么复选框(或单选按钮)不起作用?

谢谢,

Tom
If I take off the Javascript event, the checkbox works fine.

XferToDefault.Attributes.Add("onclick", "return confirm(''Are you sure you want copy these entries?'');")

<asp:CheckBox ID="XferToDefault" AutoPostBack="true"
OnCheckedChanged="XferToDefault_Click" runat="server"/>

If I change the checkbox to an ImageButton, it all works fine - the
Javascript window as well as going to the function after the Yes button is pressed.
<asp:ImageButton ID="XferToDefault" OnClick="XferToDefault_Click"
ImageUrl="../../buttons/xfer.gif" runat="server"/>

Why doesn''t the checkbox (or radiobutton) work?

Thanks,

Tom




还有一个括号:


XferToDefault.Attributes。添加(onclick,if(!confirm(''你确定要

复制这些条目吗?')))return;")

-

Eliyahu


" tshad" < tf*@dslextreme.com>在消息中写道

news:O5 ************** @ tk2msftngp13.phx.gbl ...
One more bracket:

XferToDefault.Attributes.Add("onclick", "if(!confirm(''Are you sure you want
copy these entries?''))return;")
--
Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:O5**************@tk2msftngp13.phx.gbl...
" Eliyahu Goldin" <再************* @ monarchmed.com>在消息中写道
新闻:ui ************** @ tk2msftngp13.phx.gbl ...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
Tom,
尝试

XferToDefault.Attributes.Add(" onclick"," if(!confirm(''你确定要
Tom,

Try

XferToDefault.Attributes.Add("onclick", "if(!confirm(''Are you sure you want
复制这些条目吗?'')返回;")
copy these entries?'')return;")



我试过了,但是Javascript一定有问题。我不能



I tried that, but there must be a problem with the Javascript. I don''t



得到了现在确认一下,以及不去功能。

Tom


get the confirm box at all now, as well as not going to the function.

Tom


如果有效,我可以解释原因。

Eliyahu

" tshad"< tf*@dslextreme.com>写在消息中
新闻:%2 ********* ******* @ TK2MSFTNGP09.phx.gbl ...

If it works, I can explain the reason.

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
我有以下代码将Javascript确认框附加到我的
复选框。当我选中复选框时,窗口很好,但是当我按下Ye时,它从不执行XfertoDefault_Click功能s按钮。
I have the following code that attaches a Javascript confirm box to my
checkbox. When I select the checkbox, the window comes up fine, but it never executes the XfertoDefault_Click function when I press the Yes button.
如果我取消Javascript事件,该复选框工作正常。

XferToDefault.Attributes.Add(" onclick"," return confirm(''你确定要复制这些条目吗?'');")

< asp:CheckBox ID =" XferToDefault" AutoPostBack =" true"
OnCheckedChanged =" XferToDefault_Click" runat =" server" />

如果我将复选框更改为ImageButton,它一切正常 -
Javascript窗口以及转到Yes后的函数
If I take off the Javascript event, the checkbox works fine.

XferToDefault.Attributes.Add("onclick", "return confirm(''Are you sure you want copy these entries?'');")

<asp:CheckBox ID="XferToDefault" AutoPostBack="true"
OnCheckedChanged="XferToDefault_Click" runat="server"/>

If I change the checkbox to an ImageButton, it all works fine - the
Javascript window as well as going to the function after the Yes


按钮被按下。
< asp:ImageButton ID =" XferToDefault" OnClick =" XferToDefault_Click"
ImageUrl =" ../../ buttons / xfer.gif" runat =" server" />

为什么复选框(或单选按钮)不起作用?

谢谢,

Tom

button is pressed.
<asp:ImageButton ID="XferToDefault" OnClick="XferToDefault_Click"
ImageUrl="../../buttons/xfer.gif" runat="server"/>

Why doesn''t the checkbox (or radiobutton) work?

Thanks,

Tom





这篇关于Javascript无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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