It's been common practice when coding for Firefox to do this. That it isn't the same in Chrome I hadn't noticed, see: <html> <head> <title>Test</title> <script type="text/javascript">
var event = 'test'; alert(window.event); window.onload = function() { alert(window.event); setTimeout(function() { alert(window.event); }, 1000); }; </script> </head> <body> </body> </html> Ted On Fri, Jul 17, 2009 at 5:30 PM, robotwink <robotw...@gmail.com> wrote: > > Thanks, but why it's working fine in Chrome without the function > parameter? > > On Jul 17, 5:09 pm, James <james.gp....@gmail.com> wrote: > > The event object doesn't exist in your callback function, you have to > > put it in the function parameter list: > > > > $("#send").click(function (event){ // <- over here > > > > event.preventDefault(); > > > > }); > > > > On Jul 17, 10:28 am, robotwink <robotw...@gmail.com> wrote: > > > > > > > > > Hi, > > > > > Here's how it looks: > > > > > <script type="text/javascript"> > > > <!-- > > > > > $(document).ready(function() { > > > $("#send").click(function (){ > > > > > event.preventDefault(); > > > > > }); > > > > > }); > > > > > //--> > > > </script> > > > > > On Jul 17, 4:25 pm, James <james.gp....@gmail.com> wrote: > > > > > > Without seeing the context of the rest of your code, it's difficult > to > > > > help. Are you sure 'event' is set to the correct event object? > > > > > > On Jul 17, 10:18 am, robotwink <robotw...@gmail.com> wrote: > > > > > > > Hello, > > > > > > > I'm using IE8 and when I pass: event.preventDefault(); I get an > error > > > > > message: > > > > > > > Webpage error details > > > > > > > User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; > Trident/ > > > > > 4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR > > > > > 3.0.30729; .NET CLR 3.5.30729) > > > > > Timestamp: Fri, 17 Jul 2009 20:07:41 UTC > > > > > > > Message: Object doesn't support this property or method > > > > > Line: 256 > > > > > Char: 3 > > > > > > > Please help. Thanks. >