css+div 如何实现客服窗口,在某一个id的位置显示并且悬浮

html-css011

css+div 如何实现客服窗口,在某一个id的位置显示并且悬浮,第1张

可以使用css fixed,

例:

<style>

.window{

width:100px

height:50px

position:fixedright:0top:45%//关键是这一行,设置窗口的位置,如果网页层较多,应该用z-index将窗口div置于顶层,否则会被遮盖;

z-index:999

}

</style>

<div class="window">

客服窗口,点击与客服咨询

</div>

<div style="right:0position:fixed_position:absolutebottom:100px" id="xf_01"><img src="images/1.jpg"><div style="text-align:rightheight:20px"><span onclick="document.getElementById('xf_01').style.display='none'" style="cursor:handpadding-left:100px"><a>关闭</a></span></div></div>

把你的问题去百度一搜,有很多的

<script language="JavaScript">

<!--

var pee = -200

var drec = 40

var speed = 20

//Don't touch!

var l = pee

//Don't touch. This is the function that closes the menu

function Proj7GlideBack () {l += drec

if (document.layers) {

document.menuBar.left = l

}

else if (document.all) {document.all.menuBar.style.pixelLeft = l

}

else if (document.getElementById) {document.getElementById('menuBar').style.left = l + 'px'

}

if (l <0)

setTimeout('Proj7GlideBack()', speed)

else {

if (document.layers) {

var html = ''

html += '<A HREF="javascript:"'

html += 'onClick="Proj7GlideOut()return false"'

html += 'Class="glideText"'

html += 'close'+ '<br>'

html += 'close'+ '<Br>'

html += '</A>'

var a = window.document.menuBar.document.glider

a.document.open()

a.document.write(html)

a.document.close()

}

else if (document.all) {document.all.glidetextLink.innerHTML = 'close'

document.all.glidetextLink.onclick = moveIn

}

else if (document.getElementById) {

document.getElementById('glidetextLink').firstChild.nodeValue ='close'

document.getElementById('glidetextLink').onclick = moveIn

}

}

}

//Don't touch. This is the function that opens the menu

function Proj7GlideOut () {l -= drec

if (document.layers) {document.menuBar.left = l

}

else if (document.all) {document.all.menuBar.style.pixelLeft = l

}

else if (document.getElementById) {document.getElementById('menuBar').style.left = l + 'px'

}

if (l >pee)

setTimeout('Proj7GlideOut()', speed)

else {

if (document.layers) {

var html = ''

html += '<A HREF="javascript:"'

html += 'onclick="Proj7GlideBack()return false"'

html += 'Class="glideText"'

html += 'menu'+ '<Br>'

html += 'menu'+ '<Br>'

html += '</A>'

var a = window.document.menuBar.document.glider

a.document.open()

a.document.write(html)

a.document.close()

}

else if (document.all) {document.all.glidetextLink.innerHTML = 'menu'

document.all.glidetextLink.onclick = moveOut

}

else if (document.getElementById) {

document.getElementById('glidetextLink').firstChild.nodeValue ='menu'

document.getElementById('glidetextLink').onclick = moveOut

}

}

}

function moveIn () {Proj7GlideOut()return false

}

function moveOut() {Proj7GlideBack()return false

}

<!--NNresizeFix Reloads the page to workaround a Netscape Bug-->

if (document.layers) {

origWidth = innerWidth

origHeight = innerHeight}

function reDo() {

if (innerWidth != origWidth || innerHeight != origHeight)

location.reload()}

if (document.layers) onresize = redo

//-->

</script>

<div ID="menuBar" style="">

<table width="272" border="0" cellspacing="0" cellpadding="0" bgcolor="#333333">

<tr>

<td>

<table width="100%" border="0" cellpadding="8" cellspacing="1">

<tr>

<td bgcolor="#FF9900" valign="top">

<a href="http://www.1stscript.com" onFocus="if(this.blur)this.blur()" class="menu">Home</a><Br>

<a href="http://www.1stscript.com" onFocus="if(this.blur)this.blur()" class="menu">Link

Two </a><Br>

<a href="http://www.1stscript.com" onFocus="if(this.blur)this.blur()" class="menu">Project

VII Home</a><Br>

<a href="http://www.1stscript.com" onFocus="if(this.blur)this.blur()" class="menu">Project

VII Design Packs</a><Br>

<a href="http://www.1stscript.com" onFocus="if(this.blur)this.blur()" class="menu">Link

Number Five</a><Br>

<a href="http://www.1stscript.com" onFocus="if(this.blur)this.blur()" class="menu">Link

Number Six</a>

</td>

<td width="72" bgcolor="#CC0000"></td>

</tr>

</table>

</td>

</tr>

</table>

<span ID="glider" style="">

<table border="0" cellspacing="0" cellpadding="0">

<tr align="center">

<td><a id="glidetextLink"

href="javascript:"

class="glideText"

onClick="Proj7GlideBack()return false" onFocus="if(this.blur)this.blur()">menu </a></td>

</tr>

</table></span></div>