[新着] Webテンプレートを仮オープンしました
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja" dir="ltr">
<head>
<title>test</title>
<script type="text/javascript">
//関数を定義
function TestJs(){
alert("test 1");
}
//関数を呼び出す
TestJs();
//関数を使わずに処理
alert("test 2");
</script>
</head>
<body>
<p>test</p>
</body>
</html>// 外部前提
var L = [ 'hajimeni.htm', 'step1.htm', 'aisatu.htm', 'getdate.htm', 'function.htm'];
document.write ('<p><a href="' + L[ Math.floor (Math.random () * L.length) ] + '">アンカー</a></p>');<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja" dir="ltr">
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function randomLink(){
//urlのリスト
var urlList = new Array(
"http://www.google.co.jp/",
"http://www.yahoo.co.jp"
);
//処理
location.href = urlList[Math.floor(Math.random()*urlList.length)];
}
//リンク画像
var imageUrl = "http://www.google.co.jp/hws/static/fenrir//powered_by_google.gif";
//リンクテキスト
var imageAlt = "ランダムリンク";
//alert(url);
document.write("<ul>");
document.write("<li><a href=\"javascript:randomLink();\"><img src=\"");
document.write(imageUrl);
document.write("\" alt=\"");
document.write(imageAlt);
document.write("\"></a></li>");
document.write("</ul>");
</script>
<noscript>
<p>JavaScriptを利用できる環境では、ランダムリンクが表示されます。</p>
</noscript>
</body>
</html>