JavaScript External File
JavaScript 外部ファイルについて    


画像がついてくるマウスストーカー


Pictures




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja-JP">
<head>
<meta http-equiv="content-type" content="text/html; charset=shift_jis">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="content-style-type" content="text/css">
<title>画像がついてくるマウスストーカー</title>

<script type="text/javascript">
<!--
Point = 50;	//マウスから画像の距離設定
Tunay = 45;	//停止時のマウスからの角度設定 0なら右 90なら下 180なら左 270なら上
Ikot = 0;	//0は回転停止 	数値上げると画像が回転し速度が上がっていきます。
NN = navigator.appName.charAt(0);
mouse1 = 0;
mouse2 = 0;

function Moving(){
	if (NN="M") {
		mouse1 = event.clientX;
		mouse2 = event.clientY;
		mouse1 = mouse1+document.body.scrollLeft;
		mouse2 = mouse2+document.body.scrollTop;
	}
}

function Kiros(){
	if(NN=="M") {
		Tunay = Tunay + Ikot;
		if (Tunay >= 360) {
			Tunay = Tunay-360;
		}

		x = Math.cos(Tunay*3.14/180)*Point;
		y = Math.sin(Tunay*3.14/180)*Point;

		mouseMoving.style.posLeft = mouse1+x;
		mouseMoving.style.posTop = mouse2+y;
	}
}

if(NN=="M") {
	document.onmousemove = Moving;
	Kirosid = setInterval('Kiros()',30);
}

document.write(
'<span id="mouseMoving" style="position:absolute;visibility:visible;z-index:10;">',
'<img src="drink.gif" width="32" height="32">',//使用する画像のURL
'<¥/span>');
// -->
</script>

</head>
<body>

<h1>画像がついてくるマウスストーカー</h1>


</body>
</html>

見本
記述をメモ帳にコピペし保存する際、このような表示されても、
そのまま続行(OKボタン押し)で、大丈夫です。
詳細はこちら:バックスラッシュ

 | HOME  | 相互リンク集  | 初心者に分かりやすい JavaScript サンプル | 

 | Contact us at Feedback  | SitePolicy | 

Last Update: 6 / 25 / 2008 17:24:05 JST

 | 子連れ ヘラブナ釣り  | ひかる君の写真集  | Bayani  | Balita  | Bagong Bayani  | Directory  | Yahoo! 360°  | Web BBS  | JS File |