Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Close div when clicking outside of it…

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34064
    zemaker
    Participant

    Sounds easy I know, but here is the deal.

    I am trying to get it to work with this date picker here: http://www.nsftools.com/tips/DatePickerTest.htm

    Now I have been going back and forth, but nothing I do gets me the desired result. I just want the calendar window that pops up to close if I click outside of it. Help is much appreciated.

    Here is the link to the code: http://www.nsftools.com/tips/NotesTips.htm#datepicker

    #86778
    Tri
    Member

    … don’t know if there is a way but I’d cheat.

    #86779
    Tri
    Member

    … and it tries to include the div …. here it is again without greater and less signs …

    (div id=”outside” style=”display:none;”onclick=”myclose()”) (/div)

    #86782
    Tri
    Member

    … sorry final thing which I’ve forgotten bit of script you need to get the size for the out side object

    function outside_size(){
    if(typeof window.innerWidth!=’undefined’){
    viewportheight=window.innerHeight;
    }else{
    viewportheight=document.documentElement.clientHeight;
    }
    if((viewportheight>document.body.parentNode.scrollHeight)&&(viewportheight>document.body.parentNode.clientHeight)){
    blanket_height=viewportheight;
    }else{
    if(document.body.parentNode.clientHeight>document.body.parentNode.scrollHeight){
    blanket_height=document.body.parentNode.clientHeight;}else{outside_height=document.body.parentNode.scrollHeight;
    }
    }
    var outside=document.getElementById(‘outside’);
    outside.style.height=outside_height+’px’;
    }

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.