欢迎你的访问
 
返回天空素材库首页 http://www.Skysucai.com  
收藏本站
将本站设为首页
您当前的位置:天空素材首页 -> 提供四种打开新窗的形式
 
栏 目 导 航
. 常用代码 . 综合特效
. 状态特效 . 游戏特效
. 页面背景 . 页面特效
. 页面导航 . 文本操作
. 文本特效 . 图形特效
. 鼠标特效 . 时间日期
. 密码特效 . 浏览相关
. 警告对话 . 技巧特效
. 计数转换 . 测试搜索
. 代码生成 . 播放音乐
. 按钮特效 . 系统相关
. 链接特效 . 黑客性质
. 相关特效 . 窗口特效
. 广告特效 . 表单表格
. 模拟例子
相 关 文 章
· 状态栏显示链接内容...
· 又一例闪动的标题栏...
· 让标题栏文字动起来...
· 状态栏显示链接内容...
· 在输入框中输入什么...
· 状态栏打字效果特效...
· 闪动的标题栏特效
· 字符来回出现于状态...
· 在标题栏显示时间特...
· 一款状态滚动的文字...
本 类 热 门
· 漫天飞雪网页特效代码...
· 在主页加入钟表的代码...
· 飘落的多图片
· 又一款蝴蝶飞舞的页面...
· 右键点出菜单条(出新...
· 随机文本链接
· 随鼠标栏拉动的滚动下...
· 文字播放后页面随即自...
· 上下弹动的导航条
· 点击单选框就直接激活...
· 无边的信息导航窗
· 会浮动、隐藏的导航菜...
更多  
 
 
更多  
最 新 推 荐
· 状态栏时间跳动特效
· 农历挂历特效
· 真正的万年历
· 网页特效 菜单-会动的...
· 网页特效 时间-任意位...
· 个人网页特效-有前后日...
· 时间每过一秒,Radio就...
· 时钟显示在任意指定位...
· 带开关的Form时钟
· 记录几天后的日期
· 显示登陆时间
· 退出时显示访问时间
更多  
     
提供四种打开新窗的形式
提供四种打开新窗的形式
作者:佚名  来源:本站整理  名称:提供四种打开新窗的形式 

减小字体 增大字体

       

[提示:你可先按照下面代码提示修改 上面部分代码,再按运行,此处看到的演示不完全正确]

此特效的详细完整代码如下:

要完成此效果需要两个步骤

第一步:把如下代码加入到<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>

[返回上一页] [打印提供四种打开新窗的形式]
     
| 关于本站 | 服务条款 | 友情连接 | 网站地图 | 联系方式 | 广告联系 |