1.函数无参数
<body>
<input type="submit" value="输入显示信息的次数:" onclick="showHello()"/>
<script>
function showHello()
{
var count=prompt("请输入显示信息的次数:");
for(var i=1;i<=count;i++)
{
document.write("<h3>Hello Everybody!</h3>")
}
}
</script>
</body>
2.函数有参数
<body>
<input type="submit" value="输入显示信息的次数:" onclick="showHello(prompt('请输入显示信息的次数'))"/>
<script>
function showHello(count)
{
for(var i=1;i<=count;i++)
{
document.write("<h3>Hello Everybody!</h3>")
}
}
</script>
</body>
标签:function,count,调用,函数,Everybody,编程,HTML,var From: https://www.cnblogs.com/o-O-oO/p/18099430