SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    I'm not a human
    Join Date
    Aug 2006
    Location
    India
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Setting Style.top is not working in IE!!

    hi

    i'm having a function which moves the div form one place to other.

    It's working nicely on firefox.. but it doesn't seems to be working in IE..

    I couldn't find the problem!!!

    Here's the function i'm using

    Code:
    function moveup(id)
    {
    	var fun = "moveup('"+id+"')";
    	var df  = document.getElementById(id);
    	toppos  = (df.style.top).replace('px','')-2;
    	df.style.top = toppos+"px";
    	timer2 = setTimeout(fun,50);
    }
    I'm calling the function as this
    Code:
    <img name=address style="height:20px;cursor:pointer;" 
    src="../images/mv_up.gif" onmousedown="moveup(this.name)" 
    onmouseup="stopy()" alt="Move up" title="Move up">
    I'm having the div as a relatively positioned object..
    Code:
     <div id='amt' style="position: relative; top:-165px; left:200px;
     width:100px; text-align:right;">Amount</div>
    The function is called in IE and it returns "object" when i alerted the object passed to the function moveup()..

    The div is moving nicely in firefox but not in IE..

    What's the problem and how can i correct that?

    Thanks in advance
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try alerting toppos, and seeing what you get...


  3. #3
    I'm not a human
    Join Date
    Aug 2006
    Location
    India
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    at the first time it is not alerting anything afterwards

    it is alerting -2 and going on adding -2 with the previous value..
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  4. #4
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that means when you get df.style.top its returning 0.

    try

    Code:
    toppos  = (df.offsetTop-2);



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •