如何从触发的位置识别

发布于 2025-01-26 05:38:03 字数 208 浏览 6 评论 0原文

我有两个触发点一个是编辑图标,而另一个是添加保存按钮。单击“编辑” IOCN并保存按钮一个型号获取打开。两者的模型相同。

我想重点关注单击模型的(x)触发器的图标。 我应该如何从编辑iocn 添加保存按钮中确定它的触发位置。以及如何将重点放在他们上?

I have two trigger point one is edit icon and other is add save button . on click on edit iocn and save button one model get open . model is same for both .

I want to make back focus on click on (x) icon of model from where it got trigger .
how should i identify from where it got trigger from edit iocn or from add save button . and how to back focus on them ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花期渐远 2025-02-02 05:38:03

您可以通过将值传递到函数中来做到这一点。让我通过以下示例清楚地表明。

因此有两个按钮

<button onclick="myFunction('edit')">Edit</button>
<button onclick="myFunction('save')">Save</button>

,JavaScript功能将看起来像这样

<script>
    function myFunction(event_type){
        if(event_type == 'edit'){
            //your further code for edit event goes here
        }
        else{
            //if event_type is not edit, then it's obviously save event
            //so your further code for save event goes here 
        }
    }
</script>

One way you could do this by passing a value into your function. Let me make it clear by following example.

So there are two buttons

<button onclick="myFunction('edit')">Edit</button>
<button onclick="myFunction('save')">Save</button>

and Javascript function will look something like this

<script>
    function myFunction(event_type){
        if(event_type == 'edit'){
            //your further code for edit event goes here
        }
        else{
            //if event_type is not edit, then it's obviously save event
            //so your further code for save event goes here 
        }
    }
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文