<html>
<head>
<script type="text/javascript">
function myfunction()
{
return("welcome to china!")
}
</script>
</head>
<body>
<script type="text/javascript">
document.write(myfunction())
</script>
<body>
</html>
例2
<html>
<head>
<script type="text/javascript">
function total(numberA,numberB)
{
return numberA + numberB
}
</script>
</head>
<body>
<script type="text/javascript">
document.write(total(2,3))
</script>
<body>
</html>