자바 스크립트 초보 질문요 ㅜㅜ
-
게시물 수정 , 삭제는 로그인 필요
제가 야구게임을 만들려고하는데요 테이블 세번째칸에 있는 숫자이미지를 클릭하면 테이블
두번째칸에 있는 첫번째 칸에 출력이 되고 또 누르면 두번째 또 누르면 세번째 칸에 출력이 되야 하는데
아무리 생각해봐도 모르겟어요 우선 첫번째칸에는 출력이 되는데요 그걸 받고 두번째 누르면
두번째칸 세번째 누르면 세번째 칸에 출력되도록 하는 방법 좀 알려주세요 부탁 드립니다 ㅜㅜ
이건 제가 만든 소스예요
<html>
<head><title></title></head>
<style type="text/css">
</style>
<script language="javascript">
function test(value)
{
/*var a=new Array[3]
for(i=0;i<a.length;i++)
{
a[i]
}*/
document.getElementById('out').innerHTML = value;
}
</script>
<body>
<br>
<table border=0 align=center backimage=""img\enter.bmp">
<tr>
<td colspan=10><marquee scrollamount=1 direction="right" behavior="alternate"><b>Baseball Game</marquee></td>
<tr>
<td colspan=2><marquee direction="right" behavior="alternate"><img src="img\empty1.bmp"><img src="img\empty2.bmp"><img src="img\empty3.bmp"><img src="img\empty4.bmp"><img src="img\empty5.bmp"><img src="img\empty6.bmp"><img src="img\empty7.bmp"><img src="img\empty8.bmp"><img src="img\empty9.bmp"></marquee></td>
<td colspan=2><div id="out" align="center" style="background:red;border-style:solid;"></div></td>
<td colspan=2><div id="out" align="center" style="background:red;border-style:solid;"></div></td>
<td colspan=2><div id="out" align="center" style="background:red;border-style:solid;"></div></td>
<td colspan=2><marquee direction="left" behavior="alternate"><img src="img\empty9.bmp"><img src="img\empty8.bmp"><img src="img\empty7.bmp"><img src="img\empty6.bmp"><img src="img\empty5.bmp"><img src="img\empty4.bmp"><img src="img\empty3.bmp"><img src="img\empty2.bmp"><img src="img\empty1.bmp"></marquee></td>
</tr>
<tr>
<td><input type="image" src="img\1.bmp" value="1" onClick="test(value)"></td>
<td><input type="image" src="img\2.bmp" value="2" onClick="test(value)"></td>
<td><input type="image" src="img\3.bmp" value="3" onClick="test(value)"></td>
<td><input type="image" src="img\4.bmp" value="4" onClick="test(value)"></td>
<td><input type="image" src="img\5.bmp" value="5" onClick="test(value)"></td>
<td><input type="image" src="img\6.bmp" value="6" onClick="test(value)"></td>
<td><input type="image" src="img\7.bmp" value="7" onClick="test(value)"></td>
<td><input type="image" src="img\8.bmp" value="8" onClick="test(value)"></td>
<td><input type="image" src="img\9.bmp" value="9" onClick="test(value)"></td>
<td><input type="image" src="img\enter.bmp" value="확인" onClick="test(value)"></td>
</tr>
<tr>
<td colspan=10 height=300 bgcolor="6666ff"><div id="out" style="border-style:solid;height:400;">~Select number~</div></td>
</tr>
</table>
</body>
</html>
제가 야구게임을 만들려고하는데요 테이블 세번째칸에 있는 숫자이미지를 클릭하면 테이블
두번째칸에 있는 첫번째 칸에 출력이 되고 또 누르면 두번째 또 누르면 세번째 칸에 출력이 되야 하는데
아무리 생각해봐도 모르겟어요 우선 첫번째칸에는 출력이 되는데요 그걸 받고 두번째 누르면
두번째칸 세번째 누르면 세번째 칸에 출력되도록 하는 방법 좀 알려주세요 부탁 드립니다 ㅜㅜ
이건 제가 만든 소스예요
<html>
<head><title></title></head>
<style type="text/css">
</style>
<script language="javascript">
function test(value)
{
/*var a=new Array[3]
for(i=0;i<a.length;i++)
{
a[i]
}*/
document.getElementById('out').innerHTML = value;
}
</script>
<body>
<br>
<table border=0 align=center backimage=""img\enter.bmp">
<tr>
<td colspan=10><marquee scrollamount=1 direction="right" behavior="alternate"><b>Baseball Game</marquee></td>
<tr>
<td colspan=2><marquee direction="right" behavior="alternate"><img src="img\empty1.bmp"><img src="img\empty2.bmp"><img src="img\empty3.bmp"><img src="img\empty4.bmp"><img src="img\empty5.bmp"><img src="img\empty6.bmp"><img src="img\empty7.bmp"><img src="img\empty8.bmp"><img src="img\empty9.bmp"></marquee></td>
<td colspan=2><div id="out" align="center" style="background:red;border-style:solid;"></div></td>
<td colspan=2><div id="out" align="center" style="background:red;border-style:solid;"></div></td>
<td colspan=2><div id="out" align="center" style="background:red;border-style:solid;"></div></td>
<td colspan=2><marquee direction="left" behavior="alternate"><img src="img\empty9.bmp"><img src="img\empty8.bmp"><img src="img\empty7.bmp"><img src="img\empty6.bmp"><img src="img\empty5.bmp"><img src="img\empty4.bmp"><img src="img\empty3.bmp"><img src="img\empty2.bmp"><img src="img\empty1.bmp"></marquee></td>
</tr>
<tr>
<td><input type="image" src="img\1.bmp" value="1" onClick="test(value)"></td>
<td><input type="image" src="img\2.bmp" value="2" onClick="test(value)"></td>
<td><input type="image" src="img\3.bmp" value="3" onClick="test(value)"></td>
<td><input type="image" src="img\4.bmp" value="4" onClick="test(value)"></td>
<td><input type="image" src="img\5.bmp" value="5" onClick="test(value)"></td>
<td><input type="image" src="img\6.bmp" value="6" onClick="test(value)"></td>
<td><input type="image" src="img\7.bmp" value="7" onClick="test(value)"></td>
<td><input type="image" src="img\8.bmp" value="8" onClick="test(value)"></td>
<td><input type="image" src="img\9.bmp" value="9" onClick="test(value)"></td>
<td><input type="image" src="img\enter.bmp" value="확인" onClick="test(value)"></td>
</tr>
<tr>
<td colspan=10 height=300 bgcolor="6666ff"><div id="out" style="border-style:solid;height:400;">~Select number~</div></td>
</tr>
</table>
</body>
</html>
#자바 스크립트 #자바 스크립트 소수점 버림 #자바 스크립트 문법 #자바 스크립트 기초 #자바 스크립트 다운로드 #자바 스크립트 배열 #자바 스크립트 오류 #자바 스크립트 주석 #자바 스크립트 실행 #자바 스크립트 자바 차이