| マウスがターゲット |
|---|
| ソースABがあります。それぞれをコピーしてください。ソースAのみ変更箇所があります。 ソースAは<head>から</head>にコピー |
| ソース |
| <SCRIPT LANGUAGE='JavaScript'> <!-- var cross_sprites = new Array(); //********** ここから設定部分 **********// // 垂直線の色; var cross_vertical = '#0000FF'; // 水平線の色; var cross_horizon = '#FF0000'; // 線の太さ; var cross_size = 1; //********** ここまで **********// // common functions function cross_init() { if (document.layers) { captureEvents(Event.MOUSEMOVE); onMouseMove = cross_onMouseMove_NC; for (i = 0; i < 2; i ++) cross_sprites[i] = new Cross_NC(i); } else if (document.all) { document.onmousemove = cross_onMouseMove_IE; for (i = 0; i < 2; i ++) cross_sprites[i] = new Cross_IE(i); } } // functions for NC function Cross_NC(index) { if (index == 0) document.write("<LAYER ID='CROSS" + index + "' VISIBILITY='hide' TOP=0 LEFT=0 HEIGHT=" + cross_size + " WIDTH=" + innerWidth + " Z-INDEX=10 BGCOLOR='" + cross_horizon + "'></LAYER>"); else document.write("<LAYER ID='CROSS" + index + "' VISIBILITY='hide' TOP=0 LEFT=0 HEIGHT=" + innerHeight + " WIDTH=" + cross_size + " Z-INDEX=10 BGCOLOR='" + cross_vertical + "'></LAYER>"); this.obj = document.layers['CROSS' + index]; } function cross_onMouseMove_NC(e) { if (e.pageY <= 0 || e.pageY >= innerHeight + pageYOffset - cross_size || e.pageX <= 0 || e.pageX >= innerWidth + pageXOffset - cross_size) { for (i = 0; i < 2; i ++) cross_sprites[i].obj.visibility = 'hide'; } else { cross_sprites[0].obj.y = e.pageY - 1; cross_sprites[0].obj.x = pageXOffset; cross_sprites[0].obj.width = innerWidth; cross_sprites[1].obj.x = e.pageX - 1; cross_sprites[1].obj.y = pageYOffset; cross_sprites[1].obj.height = innerHeight; for (i = 0; i < 2; i ++) cross_sprites[i].obj.visibility = 'show'; } } // functions for IE function Cross_IE(index) { if (index == 0) document.write("<DIV ID='CROSS" + index + "' STYLE='position:absolute;visibility:hidden;top:0px;left:0px;height:" + cross_size + "px;width:" + document.body.clientWidth + "px;font-size:1px;z-index:10;background:" + cross_horizon + ";'></DIV>"); else document.write("<DIV ID='CROSS" + index + "' STYLE='position:absolute;visibility:hidden;top:0px;left:0px;height:" + document.body.clientHeight + "px;width:" + cross_size + "px;z-index:10;background:" + cross_vertical + ";'></DIV>"); this.obj = document.all['CROSS' + index].style; } function cross_onMouseMove_IE() { with (document.body) { if (event.y <= 0 || event.y >= clientHeight - cross_size || event.x <= 0 || event.x >= clientWidth - cross_size) { |
| ソースB |
| <SCRIPT LANGUAGE='JavaScript'> <!-- cross_init(); //--> </SCRIPT> |
| 変更箇所 |
| ソースAの中に、このような部分があるので好みに変更してください。 //**********
ここから設定部分 **********// |