任意のメッセージを表示する

いま開いているウインドウに任意のメッセージを表示します。

1 以下のスクリプトを書いてdspmsg.jsという名前で保存します。拡張子は.jsです。このファイルが外部参照スクリプトになります。
function dspmsg(text){
document.open();
document.write("Thank you ", username );
document.close();
2 呼び出し側のhtmlは以下のようにします。

htmlのなかで'Hello this is test message'を指定して表示させています。

<html lang="ja">

<head>
<meta http-equiv="content-type" content="text/html;charset=Shift_JIS">
<meta name="generator" content="Adobe GoLive 6">
<title>dsmsg</title>
<script type="text/javascript" src="js_src/fn_dspmsg.js"></script>
</head>

<body bgcolor="#ffffff">
<p><font size="2">&lt;head&gt;のところで外部参照ファイル(dspmsg.js)を読み込み、&lt;body&gt;で実行させています。</font></p>
<p><font size="2">結果-------------------</font></p>
<p><font size="2">
<script type="text/javascript"><!--
dspmsg('hello this is test message')
// -->
</script>
</font></p>
</body>

</html>
実行例 こちら