一个简单的javascrpt程序:
<html>
<head>
<title>Greet</title>
<script type="text/javascript">
function greet()
{
var name=document.getElementById("name");
if(name)
alart("hello"+name.value);
}
</script>
</head>
<body>
<input type="text" id="name"/>
<input type="button" value="Greet" οnclick="greet()"/>
</body>
</html>