如何调用其他功能 [英] How can I call different function

查看:49
本文介绍了如何调用其他功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格:

From Date: ... To Date: ... Vehicle Number: ... button (show record) dropdownmenu

我输入日期(从和到)和车辆号,它选择记录的权利 我单击按钮,但是现在我想这样做,当我从下拉菜单中选择另一个选项时,表单保持不变:

I enter the dates (from and to) and vehicle number it select the record right when I click on button, but now I want to do it that when I select another option from drop-down menu the form remains the same:

From Date: ... To Date: ... Vehicle Number: ... button (show record) drop-down menu

当我单击按钮时,它将仅从日期"字段值中获取并运行另一个查询,而忽略数据和车辆编号.

when I click the button it will take only from Date field value and run another query and ignore to data and vehicle number.

简而言之:在下拉菜单的选择选项上,我将按钮的onClick事件更改为 运行另一个查询.

In short: on select option of drop-down menu I will change the onClick event of button to run another query.

推荐答案

不能完全确定您要问的是什么,但是如果您希望某个功能在选择框选项的选择上运行,为什么不在其上使用onchange事件呢?选择框?

Not totally sure what your asking, but if you want a certain function to run on the selection of a select box option, why not use a onchange event on the select box?

<select id="mySelect" onchange="runFunction(document.getElementById('mySelect').value);">
    <option value="myValue"></option>
    <option value="moreValues"></option>
    <option value="anotherValue"></option>
</select>

然后,该函数可以根据已传递的值执行不同的操作 一个简单的例子是

then the function can do different things depending on the values it has been passed a simple example would be

function runFunction(option){
    if(option === "myValue"){
        Do something
    }
}

这篇关于如何调用其他功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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