SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    new york
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    move popup calendar away from left edge

    Hi All.
    I use code of popup calendar that took from the site
    http://www.java2s.com/Code/JavaScrip...cyCalendar.htm

    And I need that popup calendar will move away from left edge of window. I tried to change value of variable from 0 to 50
    var leftpos = 0;
    var toppos = 0;

    but it didn't help me. How to modify code to get result?
    Thank.

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Give us a link to your test page.

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

    in that script the calendar control is placed relative to your parenttag where the control is placed.

    (i.e)The control may be placed after the body tag or the control may be placed inside any table or div etc.. then that table or div acts as parent.

    so , take a note at this,

    the folowing code is responsible for the position of the control,

    Code:
      objLeft   = obj.offsetLeft;
            objTop    = obj.offsetTop;
            objParent = obj.offsetParent;
    
            while(objParent.tagName.toUpperCase() != 'BODY') {
              objLeft  += objParent.offsetLeft;
              objTop   += objParent.offsetTop;
              objParent = objParent.offsetParent;
            }
    Change that as

    Code:
            objLeft   = obj.offsetLeft + 200;        // this will move the control to 200 pixels towards right
            objTop    = obj.offsetTop;
            objParent = obj.offsetParent;

    Check this out and it still problem arises , post again
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    new york
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    kvijayhari thanks for response.
    I did changes like you suggested but unfortunately it didnít help.
    Will appreciate for other idias. Thanks.

  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    new york
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi All.
    May be I need same changes on my onClick operation to move calendar away from left edge?

    <img src='Images/cal.gif' alt="Select0 a Date" name="date_button" width="16" height="16" align="absmiddle" onClick="popUpCalendar(this,document.Test.Date, 'mm/dd/yyyy')" />

    Thanks.


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
  •