为struts2中s:select控件生成后的下拉选项添加悬浮事件
第一:获取s:select对象
第二:循环为option中添加title属性
1.var supplierSelect = document.getElementById('id');
for(var i=0; i<supplierSelect.options.length; i++){
supplierSelect.options[i].setAttribute('title',supplierSelect.options[i].text);
}
2.function setSelectTitle(obj){
var groupObj = obj;
if(groupObj && groupObj.type =="select-one"){
for(var i = 0;i < groupObj.options.length;i++){
groupObj.options(i).title = groupObj.options(i).innerText;
}
}
}