<html>
<head><title>てすと</title>
<SCRIPT Language="JavaScript">
<!--
var xpos = new Array(3); // コメントのX座標
var ypos = new Array(3); // コメントのy座標
var hi = new Array(3); // コメント幅
var wid = new Array(3); // コメント高さ
var chk = new Array(3); // 選択されているかどうか
var nowx;
var nowy;
var flg = 0;
function Load()
{
xpos[0] = 0;
xpos[1] = 0;
xpos[2] = 0;
div11.style.left = xpos[0];
div12.style.left = xpos[1];
div13.style.left = xpos[2];
ypos[0] = 100;
ypos[1] = 200;
ypos[2] = 300;
div11.style.top = ypos[0];
div12.style.top = ypos[1];
div13.style.top = ypos[2];
wid[0] = 100;
wid[1] = 100;
wid[2] = 100;
div11.style.width = wid[0];
div12.style.width = wid[1];
div13.style.width = wid[2];
hi[0] = 20;
hi[1] = 20;
hi[2] = 20;
div11.style.height = hi[0];
div12.style.height = hi[1];
div13.style.height = hi[2];
chk[0] = 0;
chk[1] = 0;
chk[2] = 0;
}
function mdown()
{
nowx = event.clientX;
nowy = event.clientY;
for ( i = 0 ; i < 3 ; i ++ )
{
if( ( xpos[i] <= nowx ) && ( xpos[i]+wid[i] >= nowx ) &&
( ypos[i] <= nowy ) && ( ypos[i]+hi[i] >= nowy ) )
{
if ( chk[i] == 0 )
{
flg = 1;
chk[i] = 1;
chgclr(i,"blue");
}
else
{
flg = 0;
chk[i] = 0;
chgclr(i,"red");
}
}
}
}
function mmove()
{
if ( flg == 0 )
{
return;
}
posx = event.clientX;
posy = event.clientY;
for ( i = 0 ; i < 3 ; i ++ )
{
if( chk[i] == 1 )
{
xpos[i] = xpos[i] +posx - nowx;
ypos[i] = ypos[i] +posy - nowy;
switch(i)
{
case 0:
div11.style.left = xpos[0];
div11.style.top = ypos[0];
break;
case 1:
div12.style.left = xpos[1];
div12.style.top = ypos[1];
break;
case 2:
div13.style.left = xpos[2];
div13.style.top = ypos[2];
break;
}
}
}
nowx = posx;
nowy = posy;
}
function mup()
{
flg = 0;
}
function chgclr(pos,col)
{
switch(pos)
{
case 0:
div11.style.backgroundColor = col;
break;
case 1:
div12.style.backgroundColor = col;
break;
case 2:
div13.style.backgroundColor = col;
break;
}
}
// -->
</SCRIPT>
</head>
<body onload="Load()">
<div id=div1 style="position:absolute;top:0;left:0;width:500;height:500;x-index:1;"
onMouseDown="mdown()" onMouseMove="mmove()" onMouseUp="mup()">
<iframe src="http://slashdot.jp/it/08/06/06/0719236.shtml"
scrolling="no" width="500" height="500">
</iframe>
<div id=div11 style="position:absolute;x-index:2;background-color:red;">コメント1
</div>
<div id=div12 style="position:absolute;x-index:2;background-color:red;">コメント2
</div>
<div id=div13 style="position:absolute;x-index:2;background-color:red;">コメント3
</div>
</div>
</body>
</html>
|