Javascript:返回vbscript等价物 [英] Javascript:return vbscript equivalent

查看:59
本文介绍了Javascript:返回vbscript等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有相当于

" button.attributes.add(" onBlur"," javascript :re turn somfunction();") ?我认为vbscrpt也会这样做但是当我使用

vbscript运行我的代码时,无论vbscript是否返回,我的按钮点击事件都会被触发

是假还是真?任何帮助都会很棒。


谢谢,

Jim

解决方案

看看这段代码是否有帮助。所有你需要做的就是构建你的客户端

脚本。


< html>

< body>

< button OnClick =" Click1()"> Click Me< / button>

< / body>

< script语言=" VBScript">

函数Click1()

如果FuncYes则

Msgbox"返回True"

Else

Msgbox"返回False"

结束如果

如果FuncNo那么

Msgbox"返回True>

Else

Msgbox"返回False"

结束如果

结束功能

函数FuncYes()

FuncYes = True

结束函数

函数FuncNo()

FuncNo = False

结束功能


< / script>

< / html>


问候,


Trevor Benedict R

MCSD


***通过Devdex发送 http://www.devdex.com ***

不要只是参加USENET ......获得奖励!


好的,这就是我的测试目的:

ASP.net项目带有一个按钮和一个复选框。在表单加载后面的代码我有:

Button1.Attributes.Add(" onclick"," vbscript :confirm_delete()")


这是vbscript代码:


函数validMe()

如果form1.CheckBox1.Checked = False那么

validMe = False

否则

validMe = True

结束如果

结束功能

我想要发生的是代码隐藏页面中的button1_click事件,如果返回值为FALSE则不会触发。我可以用它在JavaScript中工作就好了,我需要让它在Vbscript中工作。


谢谢,

Jim


" Trevor Benedict R" < TR ******** @ yahoo.com>在消息新闻中写道:%2 **************** @ TK2MSFTNGP09.phx.gbl ...

查看此代码是否有帮助。您所要做的就是构建客户端脚本。

< html>
< body>
< button OnClick =" Click1() ">点击我< / button>
< / body>
< script语言=" VBScript">
功能Click1()
如果功能那么< brg> Msgbox返回True
其他
Msgbox返回False
结束如果
如果FuncNo那么
Msgbox返回True
其他
Msgbox"返回False"
结束如果
结束功能
功能功能()
功能=真
结束功能
功能FuncNo()
FuncNo = False
结束功能

< / script>
< / html>

问候,

Trevor Benedict R
MCSD

***通过Devdex发送 http://www.devdex.com ***
不要只是参加USENET ......获得奖励!



" Jim Ciotuszynski" <ジ**** @ hotmail.com>在消息新闻中写道:uc ************** @ TK2MSFTNGP11.phx.gbl ...

好​​的,这就是我的测试目的:

ASP.net项目,上面有一个按钮和一个复选框。在表单加载后面的代码我有:

Button1.Attributes.Add(" onclick"," vbscript :confirm_delete()")


尝试不使用vbscript :。我相信你只想要一个锚标签的href。

-

John Saunders

johnwsaundersiii at hotmail

Is there an equivalent to the
"button.attributes.add("onBlur","javascript:re turn somfunction();") ? I
thought that vbscrpt would also do the same but when I run my code with the
vbscript my button click event gets fired no matter if the vbscript returns
false or true? Any help would be great.

Thanks,
Jim

解决方案

See if this code helps. All you have to do is structure your client side
script.

<html>
<body>
<button OnClick="Click1()">Click Me</button>
</body>
<script Language="VBScript">
Function Click1()
IF FuncYes Then
Msgbox "Returns True"
Else
Msgbox "Returns False"
End If
If FuncNo Then
Msgbox "Returns True"
Else
Msgbox "Returns False"
End If
End Function
Function FuncYes()
FuncYes = True
End Function
Function FuncNo()
FuncNo = False
End Function

</script>
</html>

Regards,

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don''t just participate in USENET...get rewarded for it!


OK, this is what I have for my testing purposes:
ASP.net project with a button and a checkbox on it. in the code behind form load I have:
Button1.Attributes.Add("onclick", "vbscript:confirm_delete()")

Here is the vbscript code:

Function validMe()
if form1.CheckBox1.Checked = False then
validMe = False
Else
validMe= True
End if
End Function

What I would like to happen is the button1_click event in the code behind page not to fire if the return is FALSE. I can get it to work in JavaScript just fine, I need to get it to work in Vbscript.

Thanks,
Jim

"Trevor Benedict R" <tr********@yahoo.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...

See if this code helps. All you have to do is structure your client side
script.

<html>
<body>
<button OnClick="Click1()">Click Me</button>
</body>
<script Language="VBScript">
Function Click1()
IF FuncYes Then
Msgbox "Returns True"
Else
Msgbox "Returns False"
End If
If FuncNo Then
Msgbox "Returns True"
Else
Msgbox "Returns False"
End If
End Function
Function FuncYes()
FuncYes = True
End Function
Function FuncNo()
FuncNo = False
End Function

</script>
</html>

Regards,

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don''t just participate in USENET...get rewarded for it!



"Jim Ciotuszynski" <ji****@hotmail.com> wrote in message news:uc**************@TK2MSFTNGP11.phx.gbl...
OK, this is what I have for my testing purposes:
ASP.net project with a button and a checkbox on it. in the code behind form load I have:
Button1.Attributes.Add("onclick", "vbscript:confirm_delete()")

Try it without the "vbscript:". I believe you only want that on the href of an anchor tag.
--
John Saunders
johnwsaundersiii at hotmail


这篇关于Javascript:返回vbscript等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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