...

View Full Version : open javascript when form loads



esthera
05-09-2007, 08: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)
<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.

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

window.onload = function(){
NewCal('mydate','ddmmyyyy');
}

esthera
05-10-2007, 06: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;

glenngv
05-10-2007, 08: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?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum