Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,441
    Thanks
    15
    Thanked 0 Times in 0 Posts

    open javascript when form loads

    first I am using the javascript date picker at
    //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
    //Script featured on JavaScript Kit (http://www.javascriptkit.com)
    //For this script, visit http://www.javascriptkit.com


    Now it's called in the following way-

    Date: <input type=text name=mydate value="09/05/2007"><a href="javascript:NewCal('mydate','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a><br>(dd/mm/yyyy)
    <br>
    <input type=submit name=submit value="View"></form>

    Is there anyway I can have the javascript open the calendar when the form loads so that the user does not have to click.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Just call the function called by the link.
    Code:
    window.onload = function(){
       NewCal('mydate','ddmmyyyy');
    }

  • #3
    Senior Coder
    Join Date
    May 2004
    Posts
    1,441
    Thanks
    15
    Thanked 0 Times in 0 Posts
    thanks - that worked great -- now do you have any idea why this javascript doesn't work in firefox?
    the error in firefox is document.getElementById(pCtrl) has no properties
    [Break on this error] exDateTime=document.getElementById(pCtrl).value;

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    You have to show us more code and the related HTML. What is the value of pCtrl? And does your page contain the element that has an id of whatever the value of pCtrl is?


  •  

    Posting Permissions

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