for문 사용 관련 질문 정보
for문 사용 관련 질문본문
<SCRIPT>
function changeDiv(arg)
{
for(var i = 1 ; i <= 7 ; i ++) {
if (arg == i) {
for (var j = 1 ; j <= 7 ; j++) {
if(j == i) {
bestimg0(j).src='<?=$g4[path]?>/img/index/index_best_tab0'+ j +'_o.gif';
bestproduct0(j).style.display='inline';
} else {
bestimg0(j).src='<?=$g4[path]?>/img/index/index_best_tab0'+ j +'.gif';
bestproduct0(j).style.display='none';
}
}
}
}
}
</SCRIPT>
여기보시면 bestimg(j)라고 해놓긴 했는데 이게 구문상 맞는건지 몰라서요.. ㅠ.ㅠ
고수님들의 한수 부탁드립니다.
function changeDiv(arg)
{
for(var i = 1 ; i <= 7 ; i ++) {
if (arg == i) {
for (var j = 1 ; j <= 7 ; j++) {
if(j == i) {
bestimg0(j).src='<?=$g4[path]?>/img/index/index_best_tab0'+ j +'_o.gif';
bestproduct0(j).style.display='inline';
} else {
bestimg0(j).src='<?=$g4[path]?>/img/index/index_best_tab0'+ j +'.gif';
bestproduct0(j).style.display='none';
}
}
}
}
}
</SCRIPT>
여기보시면 bestimg(j)라고 해놓긴 했는데 이게 구문상 맞는건지 몰라서요.. ㅠ.ㅠ
고수님들의 한수 부탁드립니다.
댓글 전체
<SCRIPT>
function changeDiv(arg)
{
for(var i = 1 ; i <= 7 ; i ++) {
if (arg == i) {
for (var j = 1 ; j <= 7 ; j++) {
if(j == i) {
eval('bestimg0' + j).src='<?=$g4[path]?>/img/index/index_best_tab0'+ j +'_o.gif';
eval('bestproduct0' + j).style.display='inline';
} else {
eval('bestimg0' + j).src='<?=$g4[path]?>/img/index/index_best_tab0'+ j +'.gif';
eval('bestproduct0' + j).style.display='none';
}
}
}
}
}
자문자답이 되는군요..
이렇게 하니까 됩디다.. ㅎㅎㅎ
(무식하면 몸이 고생.. ㅠ.ㅠ)
function changeDiv(arg)
{
for(var i = 1 ; i <= 7 ; i ++) {
if (arg == i) {
for (var j = 1 ; j <= 7 ; j++) {
if(j == i) {
eval('bestimg0' + j).src='<?=$g4[path]?>/img/index/index_best_tab0'+ j +'_o.gif';
eval('bestproduct0' + j).style.display='inline';
} else {
eval('bestimg0' + j).src='<?=$g4[path]?>/img/index/index_best_tab0'+ j +'.gif';
eval('bestproduct0' + j).style.display='none';
}
}
}
}
}
자문자답이 되는군요..
이렇게 하니까 됩디다.. ㅎㅎㅎ
(무식하면 몸이 고생.. ㅠ.ㅠ)