OnClick可以调用多个函数吗? [英] Can OnClick call multiple functions?

查看:228
本文介绍了OnClick可以调用多个函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,一个按钮的OnClick事件可以调用多个函数吗?


原因是我有一个页面,当ok时单击,在将数据提交到数据库之前转到预览页面。如果修改单击,我想更改会话变量(使用VB),然后转到上一页(我知道如何做到这一点的最简单的方法是在js中的history.go(-1))。


OnClick可以调用这两个函数吗?或者有没有办法只在VB或JS中执行此操作?


TIA

- LB

I was wondering, can an OnClick event of a button call multiple functions?

The reason for this is I have a page that when "ok" is clicked, goes to a preview page before submitting data to the database. If "Modify" is clicked, I want to change session variables (using VB) and then go to the previous page (the easiest way I know how to do this is history.go(-1) in js).

Can OnClick call both functions? Or is there a way to do this in only VB or JS?

TIA
- LB

推荐答案

我认为最简单的方法是制作2个函数然后一个3将决定它想要调用哪两个。
I think the easiest way would be make 2 functions then a 3 that will decide which of the 2 it wants to call.


我想这样做的原因是因为我想使用Javascript代码以及VB代码。 VB将更改会话变量,JS将更改页面。


我已经尝试过使用VB并在Page_Load方法中说
The reason I wanted to do it this way was because I want to use Javascript code as well as VB code. The VB will change session variables and the JS will change the page.

I have since tried using VB and in the Page_Load method saying
展开 | 选择 | Wrap | 行号


你可以使用onclick调用单个函数,然后调用另外两个函数。

You can just call a single function with the onclick, then this will call 2 other function.

展开 | 选择 | Wrap | 行号


这篇关于OnClick可以调用多个函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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