我很难理解这一点。我有这个位代码:
document.getElementById("widget-container-1").innerHTML="<div class='title'>Select town: "+
"<select id='drop'>"+
"<option name='Auckland' value='Auckland'>Auckland</option>"+
"<option name='Christchurch' value='Christchurch'>Christchurch</option>"+
"<option name='Dunedin' value='Dunedin'>Dunedin</option>"+
"<option>Hamilton</option>"+
"<option>Tauranga</option>"+
"<option>Wellington</option>"+
"</select><br />"+
"<button id='update' name='update' onClick=\"this, _refreshWeatherDisplay(test);'\">update</button></div>"+
"<div class='monitor'>Sort by"+
"<input id='radio' name='input' type='radio' value='0' >town"+
"<input id='radio' name='input' type='radio' value='1' >max temp"+
"<div class='section'>test</div></div>";
select = document.getElementById("drop");
select.onchange = function(){
_checkNewTown(this.options[this.selectedIndex].text);
};
我想获取数据并执行另一个功能:
var _checkNewTown = function(ntown){
alert(this.selectedIndex);
}
但是,在 -checkNewTown 函数中保持返回未定义。当我尝试提醒它时,该按钮不起作用。
var _refreshWeatherDisplay = function(weather_info){
alert("test");
}
我知道这可能很简单,但我不知道我做错了什么如果有人可以帮助我,将不胜感激。