<!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://alink3.uic.to/user/bisoy.html"><img src="b_bn.gif"><br>画像&リンク1</a>',
'<a href="http://bagongbayani.org/"><img src="logo_sb.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>

記述をメモ帳にコピペし保存する際、このような表示されても、
そのまま続行(OKボタン押し)で、大丈夫です。
詳細はこちら:バックスラッシュ
| HOME | 相互リンク集 | 初心者に分かりやすい JavaScript サンプル |
Copyright(C)2008 bisoy , All rights reserved.
Last Update: 6 / 25 / 2008 17:19:03 JST