我有一個按鈕,當它被點擊時,我想調用一個函數。現在它只是測試。現在,當我運行它時,按鈕看起來似乎不可點擊。該按鈕沒有調用javascript函數
的index.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/stylesheet.css"/>
<script type="text/javascript" src="javascript/javascript.js"></script>
</head>
<body>
<h1>
<img src="#" alt=""/>
</h1>
<h3>1. Getting Store categories</h3>
<button onclick="getCategories()">Click here to Get Categories.</button>
<p></p>
</body>
</html>
javascript.js:
function getcategories()
{
alert("TEST");
}
EDDIT:stylesheet.css中:
* {
font-family: Ariel, Verdana, sans-serif;
}
h1 {
text-align: center;
color: #fff;
text-shadow: 0px 1px 0px #999, 0px 2px 0px #888, 0px 3px 0px #777, 0px 4px 0px #666, 0px 5px 0px #555, 0px 6px 0px #444, 0px 7px 0px #333, 0px 8px 7px #001135;
font: 80px 'ChunkFiveRegular';
}
img {
position: absolute;
top: 0; bottom:0; left: 0; right:0;
margin: auto;
}
body {
background-color: #cccccc;
}
'getCategories!= getcategories' – tymeJV
您在HTML代碼中將其稱爲'getCategories()',但在JavaScript代碼中將'getcategories()'稱爲它。 – Pointy
修復案件似乎沒有工作。 –