导航:首页 > 编程语言 > html悬挂窗口代码

html悬挂窗口代码

发布时间:2024-01-10 21:09:18

⑴ 弹出窗口的html的代码是怎么写的

1、最基本的弹出窗口代码

< SCRIPT LANGUAGE="javascript">

< !--

window.open ("page.html")

-- >

< /SCRIPT>

window.open ("page.html") 用于控制弹出新的窗口page.html,如果page.html不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。

2、经过设置后的弹出窗口

< SCRIPT LANGUAGE="javascript">

< !--

window.open ("page.html", "newwindow", "height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")&nbsp;

->

< /SCRIPT>

< SCRIPT LANGUAGE="javascript"> js脚本开始;window.open 弹出新窗口的命令;"page.html" 弹出窗口的文件名;"newwindow" 弹出窗口的名字(不是文件名),非必须,可用空"代替;

3、用函数控制弹出窗口

< script LANGUAGE="JavaScript">

< !--

function openwin() {

window.open ("page.html", "newwindow", "height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

}

-->

< /script>

这里定义了一个函数openwin(),函数内容就是打开一个窗口。

4、同时弹出2个窗口

< script LANGUAGE="JavaScript">

< !--

function openwin() {

window.open ("page.html", "newwindow", "height=100, width=100, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
&nbsp;

window.open ("page2.html", "newwindow2", "height=100, width=100, top=100, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

}

-->

< /script>

为避免弹出的2个窗口覆盖,用top和left控制一下弹出的位置不要相互覆盖即可。

5、主窗口打开文件1.htm,同时弹出小窗口page.html

< script language="javascript">

< !--

function openwin() {

window.open("page.html","","width=200,height=200")

}

-->

< /script>

⑵ html 弹出窗口有几种方式

介绍几种方法:

第一种:javascripts代码

<SCRIPTLANGUAGE="javascript">
<!--
window.open('page.html')
-->
</SCRIPT>

这一段代码可以加入HTML的任意位置,<head>和</head>之间可以,<body>间</body>也可以,越前越早执行,尤其是页面代码长,又想使页面早点弹出就尽量往前放。也可以,越前越早执行,尤其是页面代码长,又想使页面早点弹出就尽量往前放。

第二种:

<SCRIPTLANGUAGE="javascript">
<!--
window.open('page.html','newwindow','height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no')
//写成一行
-->
</SCRIPT>

第三种:函数控制

下面是一个完整的代码:
<html>
<head>
<scriptLANGUAGE="javascript">
<!--
functionopenwin(){
window.open("page.html","newwindow","height=100,width=400,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no")
//写成一行
}
//-->
</script>
</head>
<bodyonload="openwin()">
...任意的页面内容...
</body>
</html>

上面这三种弹出窗口的代码都可以应用。

⑶ html弹出悬浮窗口代码,怎么实现啊

做到比较简单
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#apDiv1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
background-color:#CCC;
left: 165px;
top: 211px;
display:none;
}
</style>
<script type="text/javascript">
function a(){
a=document.getElementById("a").value;
if(a=="tijiao"){
document.getElementById("apDiv1").style.display="block";
}
}
</script>
</head>

<body>
<input type="button" value="tijiao" id="a" onclick="a()" />
<div id="apDiv1">hello</div>
</body>
</html>

⑷ html想设置一个窗口固定浮动在页面某个位置的代码是什么啊

用 CSS 的 fixed 属性值,示例:

.infoWin{
position:fixed;
right:10px;
bottom:10px;
width:200px;
height:120px;
}

上述代码会让 .infoWin 这个元素固定悬浮在页面右下方。

⑸ HTML窗口弹出代码

<!doctype html>

<html>

<head><title>无标题文档</title></head>

<body>

<!--插入按钮 开始-->

<input type="button" value="弹出对话框" onclick="MsgBox()" />

<!--插入按钮 结束-->

<!--引用JS代码以达到弹出对话框目的 开始-->

<script language="javascript">

function MsgBox() //声明标识符

{

alert("我是对话框的内容"); //弹出对话框

}

</script>

<!--引用JS代码以达到弹出对话框目的 结束-->

</body>

</html>

(5)html悬挂窗口代码扩展阅读:

方法参数详解

参数解释:

window.open 弹出新窗口的命令;

'page.html' 弹出窗口的文件名;

'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;

height=100 窗口高度;

width=400 窗口宽度;

top=0 窗口距离屏幕上方的象素值;

left=0 窗口距离屏幕左侧的象素值;

toolbar=no 是否显示工具栏,yes为显示;

menubar,scrollbars 表示菜单栏和滚动栏。

resizable=no 是否允许改变窗口大小,yes为允许;

location=no 是否显示地址栏,yes为允许;

status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;

⑹ 在一个网页中怎样做一个悬浮窗口,并在右上角有关闭按钮的。

1、首先打开dw之后,新建一个html简单项目,输入项目名称后,就能新建一个html文件了。

⑺ 浮动窗口的代码 (html/js)

第一种方法:
Html代码
<html>
<head>
<title>浮动窗口</title>
<link type="text/css" rel="stylesheet" href="css/overflow.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/overflow.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var b = $("#b");
var overFlow = $("#over");
b.click(function(){
overFlow.fadeIn();
$("#mask").css("background","#111");
$("#mask").css("opacity","0.8");
})
$("#close").click(function(){
overFlow.fadeOut();
$("#mask").css("background","#fff");
$("#mask").css("opacity","1");
});
drag($("#over"),$("#title"));
}) ;
</script>
</head>
<body>
<div id="over">
<div id="title"><span id="t">这只是一个演示标题</span><span id="close">[ x ]</span></div>
<div id="content">
When a container object, such as a div, has mouse capture, events originating on objects within that container are fired by the div, unless the bContainerCapture parameter of the setCapture method is set to false. Passing the value false causes the container to no longer capture all document events. Instead, objects within that container still fire events, and those events also bubble as expected.<br/>
---This is edited by Alp.
</div>
</div>
<div id="mask"> <a id="b" href="#">click</a></div>
</body>
</html>

Js代码
function drag(overFlow,title){
title.onmousedown = function(evt){
var doc = document;
var evt = evt || window.event;
var x = evt.offsetX?evt.offsetX:evt.layerX;
var y = evt.offsetY?evt.offsetY:evt.layerY;
if(overFlow.setCapture){
overFlow.setCapture();
}else if(window.captureEvents){
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
}
doc.onmousemove = function(evt){
evt = evt || window.event;
var xPosition = evt.pageX || evt.clientX;
var yPosition = evt.pageY || evt.clientY;
var newX = xPosition - x;
var newY = yPosition - y;
overFlow.style.left = newX;
overFlow.style.top = newY;
};
doc.onmouseup = function(){
if(overFlow.releaseCapture){
overFlow.releaseCapture();
}else if(window.captureEvents){
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
}
doc.onmousemove=null;
doc.onmouseup=null;
};
};
}

css代码
#over{
position: absolute;
left: 300px;
top: 200px;
border: 1px solid black;
display: none;
background: #cccccc;
cursor: default;
width: 300px;
z-index: 10;
opacity: 1;
}
#title{
border: 1px solid #1840C4;
background: #95B4DC;
padding: 2px;
font-size:12px;
cursor: default;
}
#close{
cursor: pointer;
margin-right: 1px;
overflow: hidden;
}
#content{
border: 1px solid #C2D560;
background: #EFF4D7;
}
#t{
margin-right:145px;
}
#mask{
z-index: 1;
background: #fff;
width: 1024px;
height: 800px;
}
#b{
position: absolute;
left: 200px;
top: 100px;
}
body{
padding: 0px;
margin: 0px;
}
#over{
background: transparent;
}

第二种方法:
消息框遮罩层:<iframe id="show_upload_iframe" frameborder=0 scrolling="no" style="display:none; position:absolute;"></iframe><div id="show_upload">nothing...</div>'

页面加载loading中:<div id="body_loading" onClick="loaded();"><img src="__PUBLIC__/images/body_load.gif"></div>

关闭浮动窗口:<a href="javascript:hideupload()">关闭窗口建议用小图片</a>

打开浮动窗口:<a href="javascript:showupload('admin.php')">打开浮动</a>
// 消息框loading
function loading(){
var o = $('#body_loading');
o.css("left",(($(document).width())/2-(parseInt(o.width())/2))+"px");
o.css("top",(($(document).height()+$(document).scrollTop())/2-(parseInt(o.height())/2))+"px");
o.fadeIn("fast");
}
// 消息框消失
function loaded(){
var o = $('#body_loading');
o.fadeOut("fast");
}
// 隐藏浮动窗口
function hideupload(){
$('#show_upload').hide();
$('#show_upload_iframe').hide();
}
// 弹出浮动窗口
function showupload(ajaxurl){
loading();
var o=$('#show_upload');
var f=$('#show_upload_iframe');
var top = 200;
$.ajax({
url: ajaxurl,
//cache: false,
success: function(res){
loaded();
o.html(res);
o.css("left",(($(document).width())/2-(parseInt(o.width())/2))+"px");
if($(document).scrollTop()>200){
top = ($(document).height()+$(document).scrollTop())/2-(parseInt(o.height())/2);
}
o.css("top",top+"px");
f.css({'width':o.width(),'height':o.height(),'left':o.css('left'),'top':o.css('top')});
f.show();
o.show();
}
});
}

阅读全文

与html悬挂窗口代码相关的资料

热点内容
桌面文件全选按键 浏览:105
PM2019支持哪些格式文件 浏览:272
全拼app现在叫什么名字 浏览:476
win10现在成熟了吗 浏览:727
win10mtp段落无效 浏览:862
cbf收银机用什么app 浏览:336
javascript变量页面 浏览:766
网络相册淘宝 浏览:60
编程拉丝机怎么样 浏览:897
msdn不是最新版本 浏览:749
参加编程比赛学什么编程好 浏览:349
把c盘的桌面文件移走了怎么办 浏览:949
2025第三代军用北斗升级版 浏览:925
魅蓝手势密码怎么弄 浏览:509
苹果store怎么充值 浏览:224
note4应用程序许可设置在哪里 浏览:489
路由器设置没网络 浏览:539
微信无法加载视频浏览器可以加载 浏览:419
linux配置环境 浏览:868
苹果手机如何一页只留几个app 浏览:987

友情链接