JS+CSS打造可拖动的聊天窗口层(兼容)

css|js|可拖动|聊天

<!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=gb2312"> <meta http-equiv="content-script-type" content="text/javascript"> <meta http-equiv="content-style-type" content="text/css"> <title>DoDi Chat v1.0 Beta</title> <style rel="stylesheet" type="text/css" media="all" /> <!-- body { text-align:left; margin:0; font:normal 12px Verdana, Arial; background:#FFEEFF } form { margin:0; font:normal 12px Verdana, Arial; } table,input { font:normal 12px Verdana, Arial; } a:link,a:visited{ text-decoration:none; color:#333333; } a:hover{ text-decoration:none; color:#FF6600 } #main { width:400px; position:absolute; left:600px; top:100px; background:#EFEFFF; text-align:left; filter:Alpha(opacity=90) } #ChatHead { text-align:right; padding:3px; border:1px solid #003399; background:#DCDCFF; font-size:11px; color:#3366FF; cursor:move; } #ChatHead a:link,#ChatHead a:visited, { font-size:14px; font-weight:bold; padding:0 3px } #ChatBody { border:1px solid #003399; border-top:none; padding:2px; } #ChatContent { height:200px; padding:6px; overflow-y:scroll; word-break: break-all } #ChatBtn { border-top:1px solid #003399; padding:2px } --> </style> <script language="javascript" type="text/javascript"> <!-- function $(d){return document.getElementById(d);} function gs(d){var t=$(d);if (t){return t.style;}else{return null;}} function gs2(d,a){ if (d.currentStyle){ var curVal=d.currentStyle[a] }else{ var curVal=document.defaultView.getComputedStyle(d, null)[a] } return curVal; } function ChatHidden(){gs("ChatBody").display = "none";} function ChatShow(){gs("ChatBody").display = "";} function ChatClose(){gs("main").display = "none";} function ChatSend(obj){ var o = obj.ChatValue; if (o.value.length>0){ $("ChatContent").innerHTML += "<strong>Akon说:</strong>"+o.value+"<br/>"; o.value=''; } } if (document.getElementById){ ( function(){ if (window.opera){ document.write("<input type='hidden' id='Q' value=' '>"); } var n = 500; var dragok = false; var y,x,d,dy,dx; function move(e) { if (!e) e = window.event; if (dragok){ d.style.left = dx + e.clientX - x + "px"; d.style.top = dy + e.clientY - y + "px"; return false; } } function down(e){ if (!e) e = window.event; var temp = (typeof e.target != "undefined")?e.target:e.srcElement; if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"){ temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement; } if('TR'==temp.tagName){ temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement; temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement; temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement; } if (temp.className == "dragclass"){ if (window.opera){ document.getElementById("Q").focus(); } dragok = true; temp.style.zIndex = n++; d = temp; dx = parseInt(gs2(temp,"left"))|0; dy = parseInt(gs2(temp,"top"))|0; x = e.clientX; y = e.clientY; document.onmousemove = move; return false; } } function up(){ dragok = false; document.onmousemove = null; } document.onmousedown = down; document.onmouseup = up; } )(); } --> </script></head><body><div id="main" class="dragclass" style="left:600px;top:300px;"> <div id="ChatHead"> <a href="#" >-</a> <a href="#" >+</a> <a href="#" >x</a> </div> <div id="ChatBody"> <div id="ChatContent"></div> <div id="ChatBtn"> <form action="" name="chat" method="post"> <textarea name="ChatValue" rows="3" style="width:350px"></textarea> <input name="Submit" type="button" value="Chat" /> </form> </div> </div></div></body></html>

    [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

时间: 2024-10-31 13:57:40

JS+CSS打造可拖动的聊天窗口层(兼容)的相关文章

JS+CSS打造可拖动的聊天窗口层

css|js|可拖动 一个可以拖动的聊天窗口层,兼容IE和FF: <!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> <

网页实例:JS+CSS打造可拖动的聊天窗口层

css|js|可拖动|聊天|网页 <!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

JS+CSS实现可拖动的弹出提示框

 这篇文章主要介绍了JS+CSS实现可拖动的弹出提示框,涉及针对鼠标事件及html元素的操作技巧,非常具有实用价值,需要的朋友可以参考下     本文实例讲述了JS+CSS实现可拖动的弹出提示框.分享给大家供大家参考.具体实现方法如下:   代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transit

JS+CSS实现可拖动的弹出提示框_javascript技巧

本文实例讲述了JS+CSS实现可拖动的弹出提示框.分享给大家供大家参考.具体实现方法如下: 复制代码 代码如下: <!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&

js+css 实现遮罩居中弹出层

 本文为大家详细介绍下使用js实现遮罩弹出层居中,且随浏览器窗口滚动条滚动,示例代码如下,感兴趣的朋友可以参考下 js+css 实现遮罩居中弹出层(随浏览器窗口滚动条滚动)   代码如下: <!doctype html>  <head>  <meta charset="utf-8" />  <title></title>  <style type="text/css">  *{}{margin:

js+css 实现遮罩居中弹出层(随浏览器窗口滚动条滚动)_javascript技巧

js+css 实现遮罩居中弹出层(随浏览器窗口滚动条滚动) 复制代码 代码如下: <!doctype html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> *{}{margin:0;padding:0;} html{}{_background:url(about:blank);} /**//*

JS+CSS实现的拖动分页效果实例

  本文实例讲述了JS+CSS实现拖动分页效果的方法.分享给大家供大家参考.具体实现方法如下: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

JS+CSS实现的拖动分页效果实例_javascript技巧

本文实例讲述了JS+CSS实现拖动分页效果的方法.分享给大家供大家参考.具体实现方法如下: <html> <head> <title>拖动分页</title> <meta http-equiv=Content-Type content="text/html; charset=utf-8"> <style> body{ border:0px; margin:0px; overflow:hidden; backgrou

JS+CSS实现实用的单击输入框弹出选择框的方法

 这篇文章主要介绍了JS+CSS实现实用的单击输入框弹出选择框的方法,实例分析了javascript操作select及button的操作技巧,具有一定参考借鉴价值,需要的朋友可以参考下     本文实例讲述了JS+CSS实现实用的单击输入框弹出选择框的方法.分享给大家供大家参考.具体实现方法如下:   代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o