為啥出錯了
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函數調用</title>
? ?<script type="text/javascript">
? ? ? function contxt() //定義函數
? ? ? var contxt()=2;
? ? ??
? ? ? if(contxt()>=80)
? ? ? {
? ? ? ? ?alert("哈哈,調用函數了!");
? ? ? }
? ? ? else
? ? ? {
? ? ? ? ?alert("asd");
? ? ? }
? ?</script>
</head>
<body>
? ?<form>
? ? ? <input type="button" ?value="點擊我" onclick="contxt()" /> ?
? ?</form>
</body>
</html>
有什么不對的?
2015-07-27
這2行是什么意思,沒有這種寫法,謝謝。
2015-11-01
定義變量,估計不用加括號
2015-08-05
定義函數的時候要加大括號
function 函數名(){
定義函數語句;
}