开发者

Modify Current Window with JavaScript

I'm not sure if this is possible, but I'm trying to get the HTML page below (that has Frameset/Frames) to resize (the width and height), remove menubar, toolbar & scrollbar onload via JavaScript. I've been all through stack and Google to no avail.

This is for an AICC course, so unfortunately it is pertinent that I use the Frameset/Frames.

frameset.htm - Here is the original HTML page:

<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" frame开发者_如何学JAVAborder="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 - Here is the code I thought created that I thought may work, but I think I'm missing something:

<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>


The code below opens a window without menubar, scrollbars nor toolbar.

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

so,

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

also fix your courseLauncher function

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜