<script>
function abton()
{
sum=("多年不见,你好吗?");
alert(sum);
}
</script>
<input type="button" value="点击" onclick="abton()" />
<script>
function abton()
{
sum=("多年不见,你好吗?");
alert(sum);
}
</script>
<input type="button" value="点击" onclick="abton()" />
2014-08-14
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>函数调用</title> //下面是JS代码 <script text="javascript"> function abton(){ //定义函数并取名abton var sum=("多年不见,你好吗?");//取变量sum,并赋值"多年不见,你好吗?" alert(sum); } abton(); //调用函数,直接写函数名 </script> </head> <body> <form> <input type="button" value="点击我" onclick="abton()" /> </form> </body> </html>
举报