<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>无参函数</title>
<script type="text/javascript">
/**
* 无参函数
*/
function print() {
document.write('hahahhahahaa');
}
/**
* 有参函数
* @param {Object} str
*/
function print2(str) {
document.write(str);
}
/**
* 有返回值类型
* @param {Object} str
*/
function print3(str) {
document.write(str);
return 'abc';
}
</script>
</head>
<body>
<input type="button" id="a" value="点击" οnclick="print()" />
<input type="button" id="b" value="点击" οnclick="print2('1234567890')" />
<input type="button" id="c" value="点击" οnclick="alert(print3('666666'))" />
</body>
</html>
第一个'点击':
第二个'点击':
第三个'点击':