View Full Version : open javascript when form loads

05-09-2007, 09:44 PM
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)
<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.

05-09-2007, 11:52 PM
Just call the function called by the link.

window.onload = function(){

05-10-2007, 07:59 AM
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;

05-10-2007, 09:29 PM
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?