Hi
I am working with a form based gadget, that requires user input. I
want the gadget to load with some of the inputs already filled in
(date, start, end relating to today's date and time) and then if
required the user can change this to suit his/her needs.
I previously used an onload function in <body> tag, but this did not
work and then I tried using window.onload = init; and this did not
seem to work either. However, in Google Gadget Editor, each of these
methods worked find in the preview tab but as soon as they were loaded
on to my iGoogle page, they didn't seem to work.
I am now currently working with the following code using
_IG_RegisterOnloadHandler(init)
<script>
....
function init() {
var date = new Date();
var currentDay = date.getDate();
var currentMonth = months[date.getMonth()];
var currentYear = date.getFullYear();
var currentStartHH = date.getHours();
var currentEndHH = date.getHours();
if (date.getHours() < 10){
document.getElementById("StartTimeHH").value =
"0"+currentStartHH;
document.getElementById("EndTimeHH").value = "0"+currentEndHH;
}
else
{
document.getElementById("StartTimeHH").value = currentStartHH;
document.getElementById("EndTimeHH").value =
currentEndHH;
}
if (date.getDate() < 10){
document.getElementById("Day").value = "0"+currentDay;
}
else
document.getElementById("Day").value = currentDay;
document.getElementById("Month").value = currentMonth;
document.getElementById("Year").value = currentYear;
document.getElementById("StartTimeMM").value = "00";
document.getElementById("EndTimeMM").value = "30";
}
....
_IG_RegisterOnloadHandler(init);
</script>
Can anyone tell me why this is not working?
Thank you
--
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en.