File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Function call doubt

 
Sen George
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam exploring function calls in Javascript and here is a code sample.



The page gets loaded without errors but the function call does not work. Please help.
 
stef li
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just remove the "evt" in the
<input type="text" name="UserId" onfocus="displayName()">
<input type="password" name="pwd" onfocus="displayName()">

but you must remain the "evt" in the function.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It needs to be event in the event handler



when you add it to the element like this

The browser does it automatically;

If you do it with a closure, you need to specify the event


And in your function declaration function displayName( XYZ ){ you can name it abc, evt, foo, bar, etc. It does not matter. You also can use the arguments and get it that way. alert(arguments[0]);

Eric
[ October 14, 2008: Message edited by: Eric Pascarello ]
 
Sen George
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changing the line to

worked. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic