JS案例:打开新窗口并输出一则通知信息

来自CloudWiki
跳转至: 导航搜索
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script type="text/javascript">
   function openNewWin(){
      var newWin = open("","myWindow","width=400,height=100,left=0,top=10,toolbar=no,menubar=no," );
      newWin.document.open();
      newWin.document.writeln("<html><head><title>通知</title></head>");
      newWin.document.writeln("<body>");
      newWin.document.writeln("<h1>通知</h1>");
      newWin.document.writeln("<p>请同学们注意,下周举行计算机考试</p>");
      newWin.document.writeln("</body></html>");
      newWin.document.close();
      newWin.focus();
    }

</script>
<body>
    <p><a href="javascript:openNewWin()">通知</a></p>
</body>
</HTML>