+ JavaScript の質問用スレッド vol.97 +at HP
+ JavaScript の質問用スレッド vol.97 + - 暇つぶし2ch533:Name_Not_Found
12/02/16 15:27:16.63
プログラミングはじめたばかりの初心者で、初めての言語JavaScriptの初心者です。
ボールを画面の端で跳ね返らせるゲームを作ろうとしているのですが。どうしてもわからないので質問します。
<html> <head> <script type="text/javascript"> <head>
var ballx; var bally; var speedx; var speedy;
speedx = 5; speedy = 5;
if (128 < ballx ) { speedx = -speedx; } if (128 < bally ) { speedy = -speedy; }
function lyrSetPos( lyr , x , y ) {
if ( NN6 ) {
document.getElementById( lyr ).style.left = x;
document.getElementById( lyr ).style.top = y; }
if ( IE5 ) { document.getElementById( lyr ).style.pixelLeft = x;
document.getElementById( lyr ).style.pixelTop = y;
function lyrGetLeft( lyr ) }
if ( NN6 ) { return( parseInt( document.getElementById( lyr ).style.left ) ); }
if ( IE5 ) { return( parseInt( document.getElementById( lyr ).style.pixelLeft ) ); }
return( 0 ); }
function lyrGetTop( lyr ){ if ( NN6 ) {
return( parseInt( document.getElementById( lyr ).style.top ) ); }
if ( IE5 ) { return( parseInt( document.getElementById( lyr ).style.pixelTop ) ); }
return( 0 ); }
</script> </head>
<div id="lyrball" style="position:absolute; left:128px; top:128px;">
<img src="bb01.gif"> </div>
<pre><script type="text/javascript"> //<![CDATA[
ballx = lyrGetLeft( "lyrball" ); bally = lyrGetTop( "lyrball" );
function gameBody() { var x = 0; while(x > 100){
ballx = ballx + speedx; bally = bally + speedy;
lyrSetPos( "lyrball" , ballx , bally ); x++; }
//]]>
</script></pre></body></html>
こんな長い文を怒らずに見てくれて有難うございました。


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch