如何从页面调用另一个页面的事件 [英] how to call event of another page from a page
本文介绍了如何从页面调用另一个页面的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网页,比如abc.aspx和另一个网页,比如xyz.aspx。这是母版页的子页面。现在,页面abc.aspx有一个带有事件点击的按钮。同样,页面xyz.aspx也有相同事件的按钮。现在,当我点击xyz.aspx页面的按钮时,页面abc.aspx中的事件将从该按钮执行。页面abc.aspx的按钮执行javascript文件。我怎么能这样做?
提前谢谢。
I have a webpage, say abc.aspx and another webpage, say xyz.aspx. which are child page of master page. Now, page abc.aspx has a button with event click. similarly, page xyz.aspx also has button with same event. Now, when I click on button of xyz.aspx page, the event inside page abc.aspx is to be executed from that button. The button of page abc.aspx executes javascript file. how can i do so??
Thanks in advance.
推荐答案
1.据我所知,你不能从另一个页面调用一个事件。
2.您可以做的是将JavaScript代码移动到方法中,并将该方法放入可从两个页面访问的文件中。然后在两个地方调用JavaScript方法。
1.As I know, you cannot invoke an event form another page.
2.What you can do is to move your JavaScript code into a method and put that method into a file that is accessible from both pages. Then in both places to invoke the JavaScript method.
这篇关于如何从页面调用另一个页面的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文