<!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>
</head>
<body>
<h1>ボタンクリックでアラートを表示する</h1>
<script type="text/javascript">
<!--
function ipakilala(){
alert(" 訪問ありがとうございます。¥n今後ともヨロシクね。");//文章の改行は¥n
}
// -->
</script>
<input type="button" value="ご挨拶"
onClick="ipakilala()" onkeypress="ipakilala()" accesskey="Q" tabindex="2">
</body>
</html>
<!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>
</head>
<body>
<h1>ページの入退室時にアラートを表示する</h1>
<script type="text/javascript">
<!--
function MessageIN(){
alert("☆ ようこそ ☆¥n当ホームページへ"); //ページが読み込まれたときのアラート
}
window.onload = MessageIN;
function MessageOUT(theEvent){
alert("また来てください。¥n管理人より。"); //出て行くときのアラート
}
window.onunload = MessageOUT;
// -->
</script>
</body>
</html>
<!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">
<!--
function source(){
location='view-source:'+window.location;
}
// -->
</script>
</head>
<body>
<h1>ソースを表示する</h1>
<input type="button" value="ソースの表示"
onClick="source()" onkeypress="source()" accesskey="Q" tabindex="2">
</body>
</html>
<!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">
<!--
function Lihimstatus(){
window.status = '';
return true;
}
if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
document.onmouseover = Lihimstatus;
document.onmouseout = Lihimstatus;
// -->
</script>
</head>
<body>
<h1>ステータスバーに文字を表示させない</h1>
<p><a href="http://external-file.com/">JavaScript External File</a></p>
<p><a href="http://bulletin-board-system.com/">Web Bulletin Board System</a></p>
</body>
</html>
<!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>ステータスバーに流れる文字1</title>
<script type="text/javascript">
<!--
mabilis = 160; //速さの設定(数が小さいほど早い)
bilang = 87; //表示回数(表示される文字の総数)
numero = 0;
lugar = 0;
ano = 0;
function magsalita(){
message = "ようこそ・・・いらっしゃい・・・足跡ヨロシクね!・・・";
kahaba = message.length+1;
if( numero<=bilang ){
status = message.substring(0,lugar);
lugar = ( lugar>kahaba )?0:lugar+1;
numero++;
clearTimeout(ano);
ano = setTimeout('magsalita()',mabilis);
}
else if( numero>bilang )defaultstatus=" ";
}
window.onload = magsalita;
// -->
</script>
</head>
<body>
<h1>ステータスバーに流れる文字1</h1>
</body>
</html>
<!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>ステータスバーに流れる文字2</title>
<script type="text/javascript">
<!--
message0 = " ";//スペース部分の長さ
message1 = "当ホームページへようこそ!";
message2 = "このサイトは、いろいろあります。";
message3 = "お気に入りに追加してね。";
message = message0 + message1 + message0 + message2 + message0 + message3 + message0;
function magsalita(){
setTimeout("magsalita()",400);
message = message.substring(4,message.length)+message.substring(0,4);
window.status = message;
}
window.onload = magsalita;
// -->
</script>
</head>
<body>
<h1>ステータスバーに流れる文字2</h1>
</body>
</html>
<!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">
<!--
if(navigator.appVersion.charAt(0) >= '3'){
img = new Array();
img[0] = new Image;
img[0].src = 'JavaScript-External88-31-01.gif';
img[1] = new Image;
img[1].src = 'JavaScript-External88-31-6.gif';
}
function palit(a){
if(navigator.appVersion.charAt(0) >= '3'){
document.images['img1'].src=img[a].src;
}
}
// -->
</script>
</head>
<body>
<h1>マウスカーソルが重なるとき、画像を変える</h1>
<p>マウスカーソルが画像に重なるとき、画像が変わります。</p>
<p>
<a href="http://external-file.com/" onmouseover="palit(1);" onmouseout="palit(0);">
<img name="img1" src="JavaScript-External88-31-01.gif"
width="88" height="31" border="0" alt="Test Pictures"></a>
</p>
</body>
</html>
<!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>
</head>
<body>
<h1>お気に入りに追加のボタン</h1>
<script type="text/javascript">
<!--
if (!(navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4)) {
var addurl = "http://external-file.com/";//URL記入
var addtitle = "JavaScript External File";//サイト名記入
document.write(
'<input type="button" value="お気に入りに追加"'
+' onClick="window.external.AddFavorite(addurl,addtitle);"'
+' onkeypress="window.external.AddFavorite(addurl,addtitle);"'
+' accesskey="Q" tabindex="2">');
}
else {
var msg = " IE 以外は機能しません。";
document.write(msg);
}
// -->
</script>
</body>
</html>
<!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>
</head>
<body>
<h1>時間で違うメッセージを表示</h1>
<script type="text/javascript">
<!--
magsalita = new Array(24);
magsalita[0]="午前0時です。好きな言葉入れて下さい。";
magsalita[1]="午前1時です。明日も頑張りましょう";
magsalita[2]="午前2時です。そろそろ寝ましょうか?";
magsalita[3]="午前3時です。好きな言葉入れて。";
magsalita[4]="午前4時です。好きな言葉入れてね。";
magsalita[5]="午前5時です。好きな言葉入れて下さい。";
magsalita[6]="午前6時です。おはよう~!";
magsalita[7]="午前7時です。おはようございます。そろそろ出勤です。";
magsalita[8]="午前8時です。会社に着きましたか?";
magsalita[9]="午前9時です。好きな言葉入れて下さい。";
magsalita[10]="午前10時です。好きな言葉入れて下さい。";
magsalita[11]="午前11時です。好きな言葉入れて下さいね。";
magsalita[12]="午後0時です。お昼ご飯の時間です。";
magsalita[13]="午後1時です。好きな言葉入れて。";
magsalita[14]="午後2時です。好きな言葉入れてね。";
magsalita[15]="午後3時です。休憩の時間です。";
magsalita[16]="午後4時です。好きな言葉入れて。";
magsalita[17]="午後5時です。好きな言葉入れてね。";
magsalita[18]="午後6時です。もう仕事は終わりですか?";
magsalita[19]="午後7時です。お仕事お疲れ様でした。";
magsalita[20]="午後8時です。晩御飯は食べましたか?";
magsalita[21]="午後9時です。好きな言葉入れて。";
magsalita[22]="午後10時です。好きな言葉入れてね。";
magsalita[23]="午後11時です。好きな言葉入れて下さい。";
document.write('<strong>見本です。<¥/strong> ',
'<span style="color:#ff5500;font-weight:bold;">',
''+ magsalita[(new Date()).getHours()] +'',
'<¥/span>',
' <strong>見本です。<¥/strong>');
// -->
</script>
</body>
</html>
<!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">
<!--
Pic = new Array("001.jpg","002.jpg","003.jpg"); //表示したい画像のURL
image = 0;
function palit(){
document.mypictures.src = Pic[image];
image++;
if( image==3 ){//使用する画像の枚数
image = 0; //表示する回数 0で無限
}
setTimeout("palit()",4000); //表示される時間の間隔(秒数)
}
window.onload = palit;
// -->
</script>
</head>
<body>
<h1>複数の画像を順番に表示</h1>
<!-- 最初に表示したい画像のファイル名を記入 -->
<img name="mypictures" src="001.jpg" alt="Pictures">
</body>
</html>
<!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">
<!--
function Tingnan(pili){
change = pili.selectedIndex;
window.open(pili.options[change].value,'sub','status=1,scrollbars=1,resizable=1,'
+'menubar=0,location=1,toolbar=0,width=500,height=400');
}
// -->
</script>
</head>
<body>
<h1>セレクトメニューで選択されたページを別窓に表示する</h1>
<form>
<select onchange="Tingnan(this)" tabindex="2">
<option value="about:blank" selected>選んで下さい</option>
<option value="http://www.yahoo.co.jp/">Yahoo!</option>
<option value="http://www.google.co.jp/">Google</option>
<option value="http://allabout.co.jp/">All About Japan</option>
<option value="http://www.goo.ne.jp/">goo</option>
<option value="http://dmoz.org/">Open Directory Project</option>
<option value="http://www.infoseek.co.jp/">Infoseek</option>
<option value="http://www.fresheye.com/">フレッシュアイ</option>
</select>
</form>
</body>
</html>
<!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">
<!--
function Bintana(bukusan,MoveX,MoveY){
var Setting;
Setting = 'status=0,scrollbars=1,resizable=1,menubar=0,'
+'location=0,toolbar=0,width=300,height=300';
TulongBintana = window.open(bukusan, "", Setting);
TulongBintana.moveTo(MoveX,MoveY);
TulongBintana.focus();
}
function Bintana2(bukusan2,MoveX,MoveY){
var Setting;
Setting = 'status=0,scrollbars=1,resizable=1,menubar=0,'
+'location=0,toolbar=0,width=400,height=150';
TulongBintana2 = window.open(bukusan2, "", Setting);
TulongBintana2.moveTo(MoveX,MoveY);
TulongBintana2.focus();
}
// -->
</script>
</head>
<body>
<h1>新しい別窓で表示する</h1>
<p><a href="blankpage.html" name="Bintana"
onClick="Bintana('blankpage.html',100,100); return false"
onkeypress="Bintana('blankpage.html',100,100); return false">新しい別窓で表示する</a></p>
<input type="button" name="Bintana2" value="新しい別窓で表示する"
onClick="Bintana2('blankpage2.html',200,200); return false"
onkeypress="Bintana2('blankpage2.html',200,200); return false" accesskey="Q" tabindex="2">
</body>
</html>
<!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>
<!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>
</head>
<body>
<h1>ランダムにリンクや画像を表示する</h1>
<script type="text/javascript">
<!--
Random_link = new Array(
'<a href="http://www3.to/bisoy"><img src="b_bn.gif"><br>画像&リンク1</a>',
'<a href="http://bagongbayani.org/"><img src="logo.gif"><br>画像&リンク2</a>',
'<a href="http://bulletin-board-system.com/"><img src="webbbs.gif"><br>画像&リンク3</a>',
'<a href="http://bayani.jp/"><img src="top_s.gif"><br>画像&リンク4</a>',
'<a href="http://external-file.com/"><img src="java-bana3.gif"><br>画像&リンク5</a>');
//画像部分の記述で width="88" height="31" 画像のサイズ指定・・
//ここでは省略していますが、記述したほうがいいです。
Numero = Random_link.length;
Random_view = Math.floor(Math.random() * Numero);
document.write('<p style="text-align:center">',''+Random_link[Random_view]+'','<¥/p>');
// -->
</script>
</body>
</html>
<!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>ランダムにリンクや画像を表示する2</title>
</head>
<body>
<h1>ランダムにリンクや画像を表示する2</h1>
<script type="text/javascript">
<!--
Random_link = new Array(
'<img src="b_bn.gif" width="88" height="31" border="0"><br>画像1',
'<img src="logo.gif" width="88" height="31" border="0"><br>画像2',
'<img src="webbbs.gif" width="88" height="31" border="0"><br>画像3',
'<img src="top_s.gif" width="88" height="31" border="0"><br>画像4',
'<img src="java-bana3.gif" width="88" height="31" border="0"><br>画像5');
Numero = Random_link.length;//ここは変更しないように
Random_view = Math.floor(Math.random() * Numero);//ここは変更しないように
document.write(
'<p style="text-align:center">画像の表示<br><br>',
'<a href="randam_jamp2.html" target="_blank">',
''+Random_link[Random_view]+'',//ここは変更しないように
'<¥/a>',
'<¥/p>');
// -->
</script>
</body>
</html>
<!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>ランダムにリンクや画像を表示する3</title>
</head>
<body>
<h1>ランダムにリンクや画像を表示する3</h1>
<script type="text/javascript">
<!--
function bagong_view() {
window.open('randam_jamp3.html','',
'width=350,height=400,status=0,scrollbars=0',
'resizable=0,menubar=0,location=0,toolbar=0');
}
Random_link = new Array(
'<img src="b_bn.gif" width="88" height="31" border="0"><br>画像1',
'<img src="logo.gif" width="88" height="31" border="0"><br>画像2',
'<img src="webbbs.gif" width="88" height="31" border="0"><br>画像3',
'<img src="top_s.gif" width="88" height="31" border="0"><br>画像4',
'<img src="java-bana3.gif" width="88" height="31" border="0"><br>画像5');
Numero = Random_link.length;//ここは変更しないように
Random_view = Math.floor(Math.random() * Numero);//ここは変更しないように
document.write(
'<p style="text-align:center">新しい窓で画像の表示<br><br>',
'<a href="javascript:bagong_view();">',
''+Random_link[Random_view]+'',//ここは変更しないように
'<¥/a>',
'<¥/p>');
// -->
</script>
</body>
</html>