<!DOCTYPE html>
<html lang="zh-Hant-TW">
<head>
<title>function</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
</style>
</head>
<body>
<p id="paragraph"></p>
<script type="text/javascript">
function alertMe() {
alert("Hello Bruce!");
} // 定義function
alertMe(); //調用function
// --------------------------------
function alertMe( a , b ) {
alert( a + b );
}
alertMe(3 , 5); //不會回傳值
// --------------------------------
function alertMe( a , b ) {
return( a + b );
}
document.getElementById("paragraph").innerHTML = alertMe ( 6 , 3 ); // 回傳並附值
</script>
</body>
</html>
留言列表