gpt4 book ai didi

javascript - 从下拉列表中选择值时调用 javascript 函数

转载 作者:行者123 更新时间:2023-11-28 19:17:31 25 4
gpt4 key购买 nike

在下面的代码中,我有一个搜索下拉列表,可以从下拉列表中选择一个值,它应该调用一个 javascript 函数。我尝试了下面的代码,但它不起作用。请帮助我解决问题。

 function report(period) {
alert();

}

<editable:EditableDropDownList ID="ddlreporttype" onchange="report(this.value)" runat="server" Style="width: 70%; height:29px" EnableViewState="true" AutoPostBack="true" OnSelectedIndexChanged="ddlreporttype_SelectedIndexChanged" onfocus="javascript: if(this.value=='--Select--'){this.value='';}" AutoselectFirstItem="true" onblur="javascript: if(this.value==''){this.value='--Select--';}">

<asp:ListItem Text="---Select---" Value="0"></asp:ListItem>

<asp:ListItem Text="Product Valuation Report" Value="1"></asp:ListItem>
<asp:ListItem Text="Material Movement Report" Value="2"></asp:ListItem>
<asp:ListItem Text="Supply / Demand Report" Value="3"></asp:ListItem>
<asp:ListItem Text="Grn Valuation Report" Value="4"></asp:ListItem>

</editable:EditableDropDownList>

最佳答案

您是否将脚本部分放入了 Script 标签中?

<script type="text/javascript">
function report(period) {
alert("test");

}

</script>

如果没有,请这样做

关于javascript - 从下拉列表中选择值时调用 javascript 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29531493/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com