請(qǐng)問(wèn)為什么調(diào)用不了函數(shù)呢
? <script type="text/javascript">
????? function contxt() //定義函數(shù)
????? {
???????? var sum = 5+ 4;
???????? alert("sum");
????? }
????? contxt();//調(diào)用函數(shù),直接寫函數(shù)名。
?? </script>
</head>
<body>
?? <form>
????? <input type="button"? value="來(lái)打我啊" onclick="contxt()" />?
調(diào)用不了函數(shù)?
2016-09-25
分號(hào)記得用英文的分號(hào),引用變量時(shí)不要在兩端加上引號(hào),加上雙引號(hào)就被識(shí)別為字符串了。
2016-09-29
contxt();//調(diào)用函數(shù),直接寫函數(shù)名。..為什么要寫這個(gè)。。。 ? ?
2016-09-25
可以呀 ?我這出結(jié)果了 ?不知道你那是怎么回事
2016-09-25
<script type="text/javascript">
? ? ? ?function contxt() //定義函數(shù)
? ? ? {
? ? ? ? ?var sum = 4+5;
alert(sum);
? ? ? }
? ? ? contxt()
? ?</script>
</head>
<body>
? ?<form>
? ? ? <input type="button" ?value="來(lái)打我啊" onclick="contxt()" /> ?
2016-09-25
?contxt();//調(diào)用函數(shù),直接寫函數(shù)名。這行不用寫
2016-09-25
sum --"sum"