我有一个按钮,当它被点击时,我想调用一个函数。现在它只是测试。现在,当我运行它时,按钮看起来似乎不可点击。该按钮没有调用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
修复案件似乎没有工作。 –