我正在尝试在元素上添加onChange
事件。select
html 看起来像这样:
<select name="to" onChange="if(type(this.selectedIndex) != undefined){ alert('hello'); }">
<option value="newsletter">Alle nieuwsbrief-abonnees</option>
<option value="customer_all">Alle klanten</option>
<option value="customer_group">Klantengroep</option>
<option value="customer">Klanten</option>
<option value="affiliate_all">Alle affiliates</option>
<option value="affiliate">Affiliates</option>
<option value="product">Producten</option>
<option value="marketing">Alle Marketing Abbonnees</option>
<option value="marketing_all">Alle Marketing</option>
<option value="subscriber">Alle Nieuwsbrief Abbonnees & Marketing Abbonnees</option>
<option value="all">Alle Klanten & Marketing</option>
<option value="old_brian">Oude lijst Brian</option>
<option value="old_dunamis">Oude lijst Dunamis</option>
<option value="old_frohlich">Oude lijst Frohlich</option>
<option value="old_gaithers">Oude lijst Gaithers</option>
<option value="old_gospel7">Oude lijst Gospel7</option>
<option value="old_lifeshop">Oude lijst Lifeshop</option>
<option value="old_meyer">Oude lijst Meyer</option>
<option value="old_opwekking">Oude lijst Opwekking</option>
<option value="old_pelgrim_kerken">Oude lijst Perlgim Kerken</option>
<option value="old_pelgrim_klanten">Oude lijst Pelgrim Klanten</option>
<option value="old_pelgrim_pers">Oude lijst Pelgrim Pers</option>
<option value="old_pelgrim_scholen">Oude lijst Pelgrim Scholen</option>
<option value="old_test">Oude lijsten test</option>
</select>
onchange 脚本来自stackoverflow 上的答案:Is there an onSelect event or equivalent for HTML ?
但我收到以下错误:
Uncaught TypeError: string is not a function
我一头雾水,有什么问题?你不能在 onChange 事件中做一个 if 语句吗?或者是别的什么?