国产gaysexchina男同gay,japanrcep老熟妇乱子伦视频,吃奶呻吟打开双腿做受动态图,成人色网站,国产av一区二区三区最新精品

App下載
首頁javascriptmouseJavascript Event - 如何在動態(tài)創(chuàng)建的html元素上創(chuàng)建鼠標(biāo)懸停處理程序

Javascript Event - 如何在動態(tài)創(chuàng)建的html元素上創(chuàng)建鼠標(biāo)懸停處理程序

我們想知道如何在動態(tài)創(chuàng)建的html元素上創(chuàng)建鼠標(biāo)懸停處理程序。

<!DOCTYPE html>
<html>
<body>
  <div id="channels_buttons_container"></div>
<script type='text/javascript'>

channels_array = ["red", "green", "black"];
for(var i = 0; i < channels_array.length; i++) {
    loop_channel_name = channels_array[i];

    var new_button_element = document.createElement("span");
    new_button_element.id = 'channel_button_'+loop_channel_name;
    new_button_element.innerHTML = '<br>test';
    document.getElementById('channels_buttons_container').appendChild(new_button_element);

    document.getElementById('channel_button_'+loop_channel_name).onmouseover = function(){
        document.writeln('Rollover '+this.id);
    }
}

</script>
</body>
</html>