Haha

Your func def is not wrapped inside {}.
The working code (tested) is :
Code: html
<html>
<head>
<title>My Website Page 2</title>
<script type="text/javascript">
function sendalert(x)
{
if (x=="Dave")
document.write("Yourname is Dave");
else
document.write("You're not Dave");
}
</script>
</head>
<body>
<form>
<input type=text name="text" value="NAME">
<input type=button value="click Me" name="send" onclick="sendalert(form.text.value)">
</form>
</body>
</html>
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.