Your func def is not wrapped inside {}.

The working code (tested) is :
Code: html
            <title>My Website Page 2</title>
            <script type="text/javascript">
                  function sendalert(x)
                        if (x=="Dave")
                              document.write("Yourname is Dave");
                              document.write("You're not Dave");
                  <input type=text name="text" value="NAME">
                  <input type=button value="click Me" name="send" onclick="sendalert(form.text.value)">
Just ignore the hyperlinks, they are automatically added for known tags.

PS : Take care of the following points :
(1) Please post your code inside [code] ... [/ code] (no space between / and code, i gave it to stop recognizing it as code-block)
(2) Please indent your code properly, so that it would be more readable and can be debugged easily. I think, if you had indented your code, you would have easily found the mistake.

Last edited by SaswatPadhi; 12May2009 at 07:45.. Reason: Some advice added !