我正在使用此功能通过选择更改按钮处的链接,现在我想用另一个按钮添加另一个选择,但我只能通过两次添加相同的功能并更改一个名称来做到这一点。有什么提示吗?
changelink(s) {
if(s.options[0].selected){
document.getElementById('yahoo').style.visibility = 'hidden';
document.getElementById('google').style.visibility = 'hidden';
document.getElementById("wsj").style.visibility = 'visible';
}
if(s.options[1].selected){
document.getElementById('yahoo').style.visibility = 'hidden';
document.getElementById('google').style.visibility = 'visible';
document.getElementById('wsj').style.visibility = 'hidden';
}
if(s.options[2].selected){
document.getElementById('yahoo').style.visibility = 'visible';
document.getElementById('google').style.visibility = 'hidden';
document.getElementById('wsj').style.visibility = 'hidden';
}
}