function OpenHideWin(theURL)
{
hPopup = window.open(theURL, "HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
window.focus();
hPopup.resizeTo(screen.availWidth, screen.availHeight);
}
{
hPopup = window.open(theURL, "HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
window.focus();
hPopup.resizeTo(screen.availWidth, screen.availHeight);
}
解决方案 »
- 请教:js如何获取URL返回的内容呢?
- easyui插件treegrid分页问题
- 淘宝考题2
- 如何用js脚本实现按钮先获得鼠标所选的内容并实现上下标功能
- 打开窗口出现问题
- 请各位高手帮忙~~~~~~~~!!!
- 为什么这里不能用变量?
- 知道点.net的js高手帮忙啊
- 请问在netscape(windows or linux)中如何打开一个文件对话框选择文件,并往此文件中写入一些文本?
- 用Javascript统计“.”的个数,我怎么统计不出来呀?
- 怎么让<a herf="a.htm" title="注释">超链的文字</a>鼠标移上时不用等马上就显示注释文字?
- 设置打印纸张的问题.请有经验者指教。
<html>
<head>
<script>
var hPopup=""
function OpenHideWin(theURL)
{
if (hPopup=="")
{
alert("hpopup=")
hPopup=window.open("", "HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
window.focus();
hPopup.resizeTo(screen.availWidth, screen.availHeight);
}
hPopup.location = theURL;
}
</script>
</head>
<body>
<a href="javascript:OpenHideWin('001.htm')">the first</a>
<br>
<a href="javascript:OpenHideWin('002.htm')">the second</a>
</body>
</html>
但是我的调用是OpenHideWin('http:\/\/www.xxx.com\/xxx\/xxx')
有时候可以的
今天我看别人的代码,应该是这样的OpenHideWin('http://www.xxx.com/xxx/xxx')
到底要不要\?
我发现要了(有时)行,不要也行呀?
反斜杠是在老的浏览器版本用的
那时要写成这样
document.write("<\/br>")
现在在字符串里面很多情况下不用\了
至少在你的这种情况不用
例如,
var str="C:\\WINNT";
var tmp=str.indexOf("\\");
如果任一个"\\"写成'\'都会得不到预想的结果
按的需要,不用这么复杂,可以直接实现
打开第一个
window.open("第一个连接","HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
打开第二个
window.open("第二个连接","HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
对其做操作时可以用 HideWin.location.href='';
楼主的hPopup.location = theURL;应该是hPopup.location.href = theURL;
按的需要,不用这么复杂,可以直接实现
打开第一个
window.open("第一个连接","HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
打开第二个
window.open("第二个连接","HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
只要窗口名相同再次OPEN时就可以直接替换!
在这里谢谢了
function OpenHideWin(theURL)
{
var hPopup = window.open("", "HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
hPopup.blur();
hPopup.resizeTo(screen.availWidth, screen.availHeight);
hPopup.location = theURL;
}
我发现只要第一次的连接的加载过程完成,再调用这个函数就可以直接替换原来的内容。但是如果第一次的加载(比如还有一个图片没有下载完)还没有完成,第二次调用这个函数就没有任何效果。请问高手如何在用javascript中止第一次加载并使得第二次的调用有效???
window.open的第一个参数设置url就可以阿,因为window.open第二个参数是不变的,只会打开一个窗口。如下:function OpenHideWin(theURL)
{
var hPopup = window.open(theURL, "HideWin", "width=1,height=1,copyhistory=1,location=1,status=1,toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0");
hPopup.blur();
hPopup.resizeTo(screen.availWidth, screen.availHeight);
}
我记得我试过的,结果“hPopup.resizeTo(screen.availWidth, screen.availHeight);”这个句子就没效果了,据说是javascript无法控制一个已经打开了输入流的窗口,我只好先置空,再用“hpopup.location=theURL;”来连接。你再试试看你那样做“hPopup.resizeTo(screen.availWidth, screen.availHeight);”这个句子有没有效果?