发新话题
打印

JS中创建新窗口失败

JS中创建新窗口失败

下面这个JS代码有些错误,没有找到脚本调试工具,调试起来还真费劲。
复制内容到剪贴板
代码:
<script language="javascript">
<!--
//Open a new window to display the information of document
  function openwindow()
  {
  //to get URL add
  var URLinfo=document.URL;
  //to get the latest modify time
  var moditime=document.lastModified;
  //to get this page's <title></title> content
  var titleinfo=document.title;
  //to create a new window
  var w=window.open("","");
  var d=w.document;
  //var j=w.document.write;
  //use document.write() to show the information in the new window
  d.write('<html>');
  d.write('<head>');
  d.write('<title>Display the Object\'s information of document</title>');
  d.write('</head>');
  d.write('<body>');
  d.write('<h3>Follows are informations belongs Document\'s Object!</h3>'>);
  d.write('<form>');
  d.write('<font size=2>');
  d.write('原页面对应的URL地址:</font>');
  d.write('<input type="text" size=80 name="urlname" value="'+URLinfo+'">');
  d.write('<br><br>');
  d.write('<font size=2>原页面最近修改的时间:</font>');
  d.write('<input type="text" size=80 name="moditime" value="'+moditime+'">');
  d.write('<br><br>');
  d.write('<font size=2>原页面Title之间的内容:</font>');
  d.write('<input type="text" size=80 name="titlevalue" value="'+titleinfo+'">');
  d.write('</form>');
  d.write('</body>');
  d.write('</html>');
  d.close();
  }   
//-->
</script>
</head>
<body><div align=center>
<form name="whb">
    <br><br>
  <font size=4>Click this button to open new window to display document's object's information:</font>
  <br>
  <br>
    <input type="button" name="create" value="New Window" onClick="openwindow()">
</form>

TOP

发新话题