JS implementation of the drag layer, compatible Iefirefox

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags ajax content function html http javascript name public

JS Implementation drag layer, compatible Iefirefox
<! 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"
<html>
  <head>
    <TITLE> JS Implementation drag layer, compatible Iefirefox </title>
  <meta name= "generator" content= "EditPlus"
     <meta name= "Author" content= ""
     <meta name= " Keywords "content=" "
     <meta name=" Description "content=" ""
 
< SCRIPT>&NBSP
var posx;
var posy;
var popdiv;
var dragable;

function Down (e) {
Popdiv = document.getElementById ("Pop-editor");
E = e | | window.event; If it is IE
Posx = E.clientx-parseint (popDiv.style.left);
Posy = E.clienty-parseint (popDiv.style.top);
Dragable = true;
Document.onmousemove = move;
}

function Move (EV) {
if (dragable = = True) {
EV = EV | | window.event;//if it's IE
PopDiv.style.left = (EV.CLIENTX-POSX) + "px";
PopDiv.style.top = (ev.clienty-posy) + "px";
}
}

function up () {
Dragable = false;
}
</script>
</HEAD>

  <BODY>JS Implementation drag layer, compatible IEFIREFOXJS implementation drag layer, compatible IEFIREFOXJS implementation drag layer, compatible IEFIREFOXJS implementation drag layer, compatible IEFIREFOXJS implementation drag layer, Compatible IEFIREFOXJS implementation drag layer, compatible IEFIREFOXJS implementation drag layer, compatibility Iefirefox
   <div id= ' pop-editor ' style= '; height:430px;border:1px solid Red;position:absolute;left:100px;top:100px;background-color:blue ' onmousedown= ' down (event) ' onmouseup= ' Up () '
&NBSP;&NBSP;ASDFDSF
   </div>
  </BODY>
< /html>
 

Related Article

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.