Jscript
打开新窗体显示连接
应用中,经常要在一个新的窗体中显示连接的内容,例如:点击详细信息连接,弹出一个新的窗体。
以下实现:
1.
<A target=_blank href=www.csdn.new>
连接
</a>
2.
<A href=
# οnclick=”openNewWindow(‘http://www.525.com’)”
>
连接
</a>
function
openNewWindow(url)
{
if
( popupWindow !=
null
)
{
popupWindow.close();
}
popupWindow = window.open(
url
,
'PopupWindowInfo'
,
'width=540px,height=390px,resizable=no,status=0,scrollbars=1,left='
+ (screen.availWidth-540)/2 +
',top='
+ (screen.availHeight-390)/2 );
popupWindow.focus();
}
3.
<A href=
# οnclick=”openNewWindow(‘/search.do?param1=2¶m2=56’)”
>
连接
</a>
function
openNewWindow(url)
{
if
( popupWindow !=
null
)
{
popupWindow.close();
}
popupWindow = window.open(
url
,
'PopupWindowInfo'
,
'width=540px,height=390px,resizable=no,status=0,scrollbars=1,left='
+ (screen.availWidth-540)/2 +
',top='
+ (screen.availHeight-390)/2 );
popupWindow.focus();
}