SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Local variable in onclick

    calendarDayCell.onclick = function(){
    var tempDate=new Date();
    tempDate.setTime(firstOfMonth.valueOf());
    tempDate.setDate(tempDate.getDate() + d-1);
    CalendarDayClicked(tempDate);
    return false;
    }

    This code is in a for where firstOfMonth is incremented with a day.

    I want that tempdate is a local variable.
    In this way it'isnt. and at the end of the cicle onclicking in every element start the function CalendarDayClicked but ever with the last value memorized in tempdate
    How can i do?
    Thanks

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    It's very hard to understand what you're saying there.

    Please give us both the html and js so that we can easily duplicate your environment, which will make it a lot easier for you to get 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
  •