***页面特效***提供四种打开新窗的形式
把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件要完成此效果需要两个步骤
第一步:把如下代码加入到<head>区域中
<script language="javascript">
<!-- begin
var version4 = (navigator.appversion.charat(0) == "4");
var popuphandle;
function closepopup() {
if(popuphandle != null && !popuphandle.closed) popuphandle.close();
}
function displaypopup(position,url,name,height,width,evnt) {
// position=1 popup: makes screen display up and/or left, down and/or right
// depending on where cursor falls and size of window to open
// position=2 center: makes screen fall in center
var properties = "toolbar = 0, location = 0, height = " + height;
properties = properties + ", width=" + width;
var leftprop, topprop, screenx, screeny, cursorx, cursory, padamt;
if(navigator.appname == "microsoft internet explorer") {
screeny = document.body.offsetheight;
screenx = window.screen.availwidth;
}
else {
screeny = window.outerheight
screenx = window.outerwidth
}
if(position == 1) { // if popup not center
cursorx = evnt.screenx;
cursory = evnt.screeny;
padamtx = 10;
padamty = 10;
if((cursory + height + padamty) > screeny) {
// make sizes a negative number to move left/up
padamty = (-30) + (height * -1);
// if up or to left, make 30 as padding amount
}
if((cursorx + width + padamtx) > screenx) {
padamtx = (-30) + (width * -1);
// if up or to left, make 30 as padding amount
}
if(navigator.appname == "microsoft internet explorer") {
leftprop = cursorx + padamtx;
topprop = cursory + padamty;
}
else {
leftprop = (cursorx - pagexoffset + padamtx);
topprop = (cursory - pageyoffset + padamty);
}
}
else{
leftvar = (screenx - width) / 2;
rightvar = (screeny - height) / 2;
if(navigator.appname == "microsoft internet explorer") {
leftprop = leftvar;
topprop = rightvar;
}
else {
leftprop = (leftvar - pagexoffset);
topprop = (rightvar - pageyoffset);
}
}
if(evnt != null) {
properties = properties + ", left = " + leftprop;
properties = properties + ", top = " + topprop;
}
closepopup();
popuphandle = open(url,name,properties);
}
//end -->
</script>
第二步:把如下代码加入到<body>区域中
<form name="formtest">
<div align="center">窗口宽度:
<input maxlength=3 size=3 type=text value="220" name="testwidth">
窗口高度:
<input maxlength=3 size=3 type=text value="120" name="testheight">
<br>
<a href="javascript:void(0)" onmouseover="window.status='click for more information'; return true" onclick="displaypopup(1,'link.htm','popup3',document.formtest.testheight.value,document.formtest.testwidth.value,(version4 ? event : null));">test
popclick</a> <br>
<a href="javascript:void(0)" onmouseover="window.status='click for more information'; return true" onclick="displaypopup(2,'link.htm','popup3',document.formtest.testheight.value,document.formtest.testwidth.value,(version4 ? event : null));">test
popclickcenter</a> <br>
<a href="javascript:void(0)" onmouseover="displaypopup(1,'link.htm','popup1',document.formtest.testheight.value,document.formtest.testwidth.value,(version4 ? event : null))" onmouseout="closepopup()">test
popup</a> <br>
<a href="javascript:void(0)" onmouseover="displaypopup(2,'link.htm','popup2',document.formtest.testheight.value,document.formtest.testwidth.value,(version4 ? event : null))" onmouseout="closepopup()">test
popupcenter</a> </div>
</form>
--------------------------------------
拥有三人行论坛管理系列软件,一个人就可以管理一个论坛的更新维护。还能使您的论坛有千人在线的真实火暴效果,让您不在为论坛因没有人气而留不住会员而烦恼,使您的论坛早日成为一流的论坛。详情请登陆网站:http://www.cnsrx.cn 三人行论坛管理软件,站长必备的专业好工具。(您使用的是免费版本,购买收费版本后,将不带广告。业务QQ:247216 44985227)
页:
[1]