Results 1 to 3 of 3

Thread: Can Javascript affect the css divs?

  1. #1
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default Can Javascript affect the css divs?

    1) Script Title: Jason's Date Input Calendar

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...oncalendar.htm

    3) Describe problem: The calendar works great and everything. I'm just wondering if javascript can screw up css? Is there a way to encapsulate the javascript so that it behaves within my divs? I checked the js code and didn't find any </div>'s, but nevertheless it forces anything beside the mini-cal image on the right side of the calendar down to the next line even though I have { display:inline; } . It also somehow "leaks" into the div below in FF.

    Here's my css for the little div that holds the date field:

    Code:
    #enddate { width:740px; height:42px; float:left; margin-top:7px; display:inline; }
    I've used other DD js scripts and did not have this problem. I can't find any errors in my css for the surrounding divs (but I'm pretty bleary right about now).

    Thanks for any insight.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'd like to see the page. However, this sounds like a case where something which ordinarily should be absolutely positioned, either is, and is being added to a relatively or absolutely positioned container instead of to the body element itself, or that it isn't absolutely positioned. If it is either of these two cases, more likely the second, it can 'push' other things in the layout around.

    More broadly, javascript can affect just about anything in a document's content or style. Generally this is intentional and gracefully executed, though unexpected results can happen when the code isn't well thought out, and/or is applied to a page in a way that is different than originally intended by the code's author.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Thanks, John. I fixed it. I just had to put the javascript in its own div within the enddate div. I was just over-tired and couldn't think straight. Appreciate your help.

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
  •