www.webdeveloper.com
Results 1 to 2 of 2

Thread: multiple calendars when clicked twice

  1. #1
    Join Date
    Aug 2007
    Posts
    130

    Question multiple calendars when clicked twice

    I have a calendar popping up it works great except for the fact if you click the calendar and it pops up and happen to click the calendar again another calendar comes up and so on. what am I doing wrong, and how can I get it to where if accidentally clicking the calendar twice that when click once the cal appears and click again and it hides.

    thanks for the help

    Code:
    function showCal(id,dateField) {
    
    var dp = new Ext.DatePicker({ renderTo:id, format:"m/d/y", idField:dateField });
    
    //get the element
    var el = document.getElementById(dateField);
    if(el.value != "")
    {
    selectedDate = new Date(el.value);
    dp.setValue(selectedDate);
    }
    dp.addListener("select", onSelect);
    }
    
    function onSelect(datePicker,date)
    {
    var dt = new Date(date);
    document.getElementById(datePicker.idField).value = dt.format("m/d/Y");
    datePicker.destroy();
    }
    Code:
    <td class="inputdata">
    		<input type="text" name="duedate" id="start"/>
    		<img src="images/calendar.png" alt="" onclick="showCal('date1-cal','start');"></img>
    		<div id="date1-cal" style="position:absolute;"></div>
    	  </td>

  2. #2
    Join Date
    May 2004
    Location
    FL
    Posts
    3,447
    You could try something like this.
    Lee

    ""Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."" -- Sir Winston Churchill

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles