使用JavaScript修改当前窗口

时间:2011-07-15 15:09:20

标签: javascript frames frameset

我不确定这是否可行,但我正在尝试将下面的HTML页面(具有框架集/框架)调整大小(宽度和高度),删除菜单栏,工具栏和工具栏。通过JavaScript滚动条onload。我一直都在堆栈和谷歌无济于事。

这是针对AICC课程的,不幸的是我使用Frameset / Frames是相关的。

frameset.htm - 以下是原始HTML页面:

<html>
<head>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset frameborder="0" border="0" framespacing="0" rows="*,1">
  <frame src="course.htm" scrolling="0" frameborder="0">
  <frame src="results.htm" scrolling="0" frameborder="0">
  <noframes>
    <body>
      <p>This web page uses frames, but your browser doesn't support them.</p>
    </body>
  </noframes>
</frameset>
</html>

frameset.htm - 这是我认为可能有用的代码,但我觉得我错过了一些东西:

<html>
<head>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
function courseLauncher(theURL,winName,features) {
  window.open('','_self','');
  window.open(theURL,winName,features);
  this.focus();
}
</script>
</head>
<frameset frameborder="0" border="0" framespacing="0" rows="*,1" onLoad="courseLauncher('frameset.htm','course','width=1000,height=700');">
  <frame src="course.htm" scrolling="0" frameborder="0">
  <frame src="results.htm" scrolling="0" frameborder="0">
  <noframes>
    <body>
      <p>This web page uses frames, but your browser doesn't support them.</p>
    </body>
  </noframes>
</frameset>
</html>

1 个答案:

答案 0 :(得分:0)

下面的代码打开一个没有菜单栏,滚动条或工具栏的窗口。

window.open ("","mywindow","menubar=0,scrollbars=0,toolbar=0, width=350,height=250");

所以,

courseLauncher('frameset.htm','course','menubar=0,scrollbars=0,toolbar=0,width=1000,height=700')

还修复了courseLauncher函数

function courseLauncher(theURL,winName,features) {
  var win = window.open(theURL,winName,features);
  win.focus();
}