フォームのチェックボタンで表示を切り替える

<script type="text/javascript">
function payChange(){
radio = document.getElementsByName('payChangeFlag')
if(radio[0].checked) {
document.getElementById('select_bank').style.display = "";
document.getElementById('select_credit').style.display = "none";
}else if(radio[1].checked) {
document.getElementById('select_bank').style.display = "none";
document.getElementById('select_credit').style.display = "";
}
}
//オンロードさせ、リロード時に選択を保持
window.onload = payChange;
</script>