这是我整个JavaScript体验的第二天,所以请耐心等待。我能打开一个新窗口,没问题。我可以在打开时将该窗口指向某个URL。再说一遍,没问题。我似乎无法在新窗口上操纵任何东西。这是到目前为止的代码:(在脚本的末尾,我关闭了原始窗口。)
var win = window.open("URL",'','channelmode,height=' +
window.screen.availHeight + ',width=' + window.screen.availWidth + ',')
var output = "<input type=\"button\" value=\"Close Window\" onclick=\"windowClose();\">"
//Doesn't work..
win.document.body.innerHTML += output //also tried with just --> ...innerHTML = output
//
//Doesn't work..
win.dataFromParent = output
win.document.body.innerHTML(dataFromParent)
//win doesn't actually have the variable "dataFromParent" defined in the code, and I can't change the page that is loaded to include it, so is that why this isn't working?
//Doesn't work..
win.dataFromParent = output
win.document.body.appendChild(dataFromParent)
//
function windowClose() {
window.open('','_parent','');
window.close();
}
windowClose() //Done in this manner to prevent the "Page trying to close window..." dialog box
我正在尝试做两件事:
在打开的窗口(赢)上,在某个位置放置一个按钮,关闭窗口(赢)
在打开的窗口(win)上,禁用某人能够双击标题栏并更改窗口大小的功能。 (我知道&#34; window.open&#34;有一个&#34;可调整大小的&#34;选项,可以设置为&#34; no&#34;但这似乎并没有真正起作用。 )
这些是我用来尝试找出第一项任务的主要链接。
Add content to a new open window http://www.computerhope.com/issues/ch000178.htm How to open a new window and insert html into it using jQuery? http://www.w3schools.com/jsref/met_win_open.asp
我真的不知道如何做第二个...我所看到的任何地方都只有其他语言的东西..