[英]Blackberry WebWorks change
I'm working with Webworks for blackberry and i cant get to fire change on the device, in ripple it works like a charm but in the devices the change event doesn't fire... hope some1 can help me 我正在使用Webworks for Blackberry,但无法在设备上触发更改,在波纹中它像咒语一样起作用,但是在设备中,更改事件不会触发...希望some1可以帮助我
HTML 的HTML
<select name="motherCat" onchange="motherChanged(event)">
<option value="0">option0</option>
<option value="1">option1</option>
<option value="2">option3</option>
</select>
<select id="subCategory">
<option value="0">wait mother change to fill</option>
</select>
Javascript Java脚本
function motherChanged(event){
alert("motherChanged");
var retCategory =subcategories[event.target.value];
var fin = retCategory.length;
var slCat = $('subCategory');
slCat.length = 0;
for(var i = 0;i<fin;i++){
slCat.options.add(new Option(retCategory[i].text,retCategory[i].value));
}
}
The problem is in how you've set the onchange
property. 问题在于您如何设置
onchange
属性。 event
is undefined. event
未定义。 Rather use something that will be defined: 而是使用将要定义的内容:
<select name="motherCat" onchange="motherChanged(this)">
The this
parameter will be the select element itself. this
参数将是选择元素本身。 Of course, you could also have a function that accepts no parameters, and then you can leave out the this
. 当然,您也可以有一个不接受任何参数的函数,然后可以忽略
this
。
You could also use 您也可以使用
<select name="motherCat" onchange="motherChanged">
and JavaScript should call the function with the event as a parameter. JavaScript应该使用事件作为参数来调用函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.