日期:2014-05-16  浏览次数:20361 次

调用弹出页面时,却把当前所看的页面替换了.....
通过DELPHI写的程序,调用ShellExecute(handle,nil,pchar( '下面页面的网址 '),nil,nil,sw_shownormal);

<%@   page   contentType= "text/html;   charset=gb2312 "   %>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> </title>

</head>
<script>
  var   winObj;
  var   WinMyWidth=300;
  var   WinMyHeight=216;    
        var   myLeft   =   screen.width   -   WinMyWidth-15;
var   myTop   =   screen.height   -   WinMyHeight-60;
var   openWindowSty= "toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=auto,left= "+   myLeft   + ",top= "+   myTop   + ",width= "+   WinMyWidth   + ",height= "+WinMyHeight;
        var   openUrl= "11.jsp ";
  winObj=window.open(openUrl,   " ",   openWindowSty);
   
</script>
<body>
.........
</body>
</html>
<script>
window.opener=null;
window.close()
</script>
结果是,当程序调用这个页面的时候,有些电脑很正常,能只弹出11.jsp,可有些电脑却会替换已打开的一个页面,再弹出11.jsp..请问哪一个高手遇到过这样的问题

------解决方案--------------------
winObj=window.open(openUrl, " ", openWindowSty);
---> > >
winObj=window.open(openUrl, "_blank ", openWindowSty);
------解决方案--------------------
应该去改你的delphi吧

procedure OpenUrlDefBrowser(AHandle:HWND;AUrl:string);
begin
try
shellexecute(AHandle, 'open ', PChar(GetDefBrowser()), PChar(AUrl), nil, SW_NORMAL);
//shellexecute(AHandle, 'open ', 'Iexplore.exe ', PChar(AUrl), nil, SW_NORMAL);
except
end;
end;

function GetDefBrowser():String;
var
Browser: string;
begin
Result := 'Iexplore.exe ';
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
Access := KEY_QUERY_VALUE;
if OpenKey( 'htmlfile\shell\open\command\ ', false) then
Browser := ReadString( ' ');
CloseKey;
finally
Free;
end;
if Browser = ' ' then exit;
Browser := Copy(Browser, Pos( ' " ', Browser) + 1, Length(Browser));
Browser := Copy(Browser, 1, Pos( ' " ', Browser) - 1);
Result := Browser;
end;
------解决方案--------------------
把这个
winObj=window.open(openUrl, " ", openWindowSty);

</script>
<body>
.........
</body>
</html>
<script>
window.opener=null;
window.close()
</script>
改为:
winObj=window.open(openUrl, "_blank ", openWindowSty);//这个和二楼一样

</script>
<body>
.........
</body>
</html>
<script>
window.opener.close()//不清空,直接关闭
</script>
有一些电脑连弹出窗口都没有
这个只要打开IE--INTER选项--隐私--阻止弹出窗口,前面的钩取消,就行了