Posted on 2006-03-31
Last Modified: 2007-12-19
Thank you for looking at my problem. This nice code below works well in IE. Floating DIV element can be moved and dragged around the page.
Firefox, however, does not allow typing in the text field. Seems like dragging method covers HTML functionality. Can anyone help? Could it be a CSS "clear" method to be used?


<style type="text/css">
      top: 120px;
      left: 130px;
<script type="text/javascript">

var ie = document.all;
var ns6 = document.getElementById && !document.all;
var dragapproved=false;
var z, x, y;
function move(e) {
  if (dragapproved) { temp1+e.clientX-x: temp1+event.clientX-x; temp2+e.clientY-y : temp2+event.clientY-y;
    return false;
function drags(e) {
  if (!ie&&!ns6)
  var firedobj = ns6? : event.srcElement;
  var topelement = ns6? "HTML" : "BODY";
  while (firedobj.tagName != topelement&&firedobj.className != "drag") {
    firedobj = ns6? firedobj.parentNode : firedobj.parentElement;
  if (firedobj.className == "drag") {
    dragapproved = true;
    z = firedobj;
    temp1 = parseInt(;
    temp2 = parseInt(;
    x = ns6? e.clientX: event.clientX;
    y = ns6? e.clientY: event.clientY;
    return false;
document.onmouseup=new Function("dragapproved=false");

<div id="vunet" class="drag" style="position: absolute; top: 120px; left: 130px;">
  <table><tr><td><input type="text"></td></tr></table>
  <table><tr><td><a href=''>LINK</a></td></tr></table>

Question by:Vadymus
    LVL 17

    Accepted Solution

    Hi Vadymus,

    [These are not solutions, just things I saw]
    Right click seems to work to get the mouse into the textarea.
    Maybe you could just focus() immediatly into the textfield whenever the user has finshed moving that floating div.

    Joe P

    Author Comment

    Hm, what you noticed could be a solution... I wonder why is it like that?

    This worked: onFocus="this.focus();"
    LVL 17

    Expert Comment

    hehe, nice trick =)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
    This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
    In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
    In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now