まずは試してみましょう。
<SCRIPT LANGUAGE="JavaScript"> function newwindow() { nwin = window.open("", "Newwindow","width=280,height=480"); nwin.document.open(); nwin.document.write("<HTML><HEAD>"); nwin.document.write("<TITLE>New one</TITLE>"); nwin.document.writeln("<BODY>"); nwin.document.write("This is new one. Written in HTML."); nwin.document.write("<IMG SRC=\"http://www.ueda.info.waseda.ac.jp/~gaku/js/latour.gif\">"); nwin.document.write("</BODY></HTML>"); nwin.document.close(); return false; } </SCRIPT> <A HREF="dummy.html" onClick="return newwindow()">このリンク</A> をクリックすると、新しいウィンドウを開くことができます。
Netscape 3.0のJavaScriptでは、onClickがfalseで終わった 場合、リンクのクリックを中止したと判断するようになりました。そこで、 関数newwindow()でfalseを返し、それをreturn文でさらにonClickの戻り値 としてやることにより、リンクをクリックしても他のページに行かなく なります。