Floating Layer Display JS

Source: Internet
Author: User
Tags visibility
js| Float | floating Layer | show

var offsetx =-120;
var offsety =-100;
NS4 = (document.layers)? True:false
ie4 = (document.all)? True:false

if (IE4) {
if (Navigator.userAgent.indexOf (' msie 5 ') >0) {
IE5 = true;
} else {
IE5 = false; }
} else {
IE5 = false;
}

var x = 0;
var y = 0;
var para = 0;
var sw = 0;
var cnt = 0;
var dir = 1;
var tr=1;
if ((NS4) | | (IE4)) {
if (ns4) over = Document.overdiv
if (ie4) over = Overdiv.style
Document.onmousemove = MouseMove
if (NS4) document.captureevents (event.mousemove)
}
function Hide () {
if (CNT >= 1) {sw = 0};
if ((NS4) | | (IE4)) {
if (sw = = 0) {
Para = 0;
Hideobject (over);
} else {
cnt++;
}
}
}

Function Show (TXT) {
Layerwrite (TXT);
Disp ();
}
function Layerwrite (TXT) {
if (NS4) {
var lyr = document.overDiv.document
Lyr.write (TXT)
Lyr.close ()
}
else if (ie4) document.all["overdiv"].innerhtml = txt
if (tr) {}
}
Function disp () {
if ((NS4) | | (IE4)) {
if (para = = 0) {//Right
MoveTo (over,x+offsetx,y+offsety);
}
Showobject (over);
Para = 1;
}
}

function MouseMove (e) {
if (NS4) {X=e.pagex; Y=e.pagey}
if (IE4) {x=event.x; Y=event.y}
if (IE5) {x=event.x+document.body.scrollleft; Y=event.y+document.body.scrolltop}
if (para) {
MoveTo (over,x+offsetx,y+offsety);
}
}
function Cclick () {
Hideobject (over);
sw=0;
}

Make an object visible
function Showobject (obj) {
if (ns4) obj.visibility = "Show"
else if (ie4) obj.visibility = "visible"
}

Hides an object
function Hideobject (obj) {
if (ns4) obj.visibility = "Hide"
else if (ie4) obj.visibility = "hidden"
}

Move a layer
function MoveTo (obj,xl,yl) {
Obj.left = XL
Obj.top = YL
}

Also, add the appropriate location to the page you want to display:
<div id=overdiv style= "Position:absolute; Z-index:1 "></DIV>
<script language=javascript src= "Xxx.js" ></SCRIPT>

Example Address: http://www.xrss.cn/fjcity.asp



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.