• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

onclick event

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have this javascript fuunction and wehn I try to call it on onclick event it say object doesn't support this property?? Can anyone help me out here
thanks in advance
-PC
-----------------------------------
function today(form){
var d = new Date();
var todaydate= d.getFullYear()+"-"+(d.getMonth() + 1)+"-"+d.getDate();
document.form.modificationDate.value=todaydate;
}
-------------------------------------
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Priyanka Chopda:
Hi,
I have this javascript fuunction and wehn I try to call it on onclick event it say object doesn't support this property?? Can anyone help me out here
thanks in advance
-PC
-----------------------------------
function today(form){
var d = new Date();
var todaydate= d.getFullYear()+"-"+(d.getMonth() + 1)+"-"+d.getDate();
document.form.modificationDate.value=todaydate;
}
-------------------------------------


Hi Priyanka,
I just created a simple example and it worked.
I think the problem is @ document.form.modificationDate.value=todaydate;
Did you create FORM tags in your html code and/or did you give a form name.
If you did not create a form name just call any name and replace it with the form
Hope this helps.
[ September 26, 2003: Message edited by: sam patel ]
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
what is the parameter "form" good for?
I assume it's the name of the form, wich named differently (not "form").
1. form is an JavaScript Object. Use another name.
2. If you intend to get access to the parameter's properties use it without "document".

If it doesn't work, it would be helpful if you posted how you call today()
hth cb
[ September 26, 2003: Message edited by: Chris Baron ]
 
Priyanka Chopda
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm calling in submit type as
today(this.form)
-PC
 
Chris Baron
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Know what's happening?
The form does what it's job is... it submits, faster than one can see
if you call it with return and you return false for testing you can see it's working:


<html><head>
<script>
<!--
function today(parameter)
{
var d = new Date();
var todaydate= d.getFullYear()+"-"+(d.getMonth() + 1)+"-"+d.getDate();
parameter.modificationDate.value=todaydate;

return false; //Set this to "true" in production
}
//-->
</script>
</head><body>
<form name="abc" action="#">
<input type="text" name="modificationDate">
<input type="submit" onclick="return today(this.form)">
</form>
</body></html>

 
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic