我正在尝试根据单击的图像显示和隐藏 div,因此当您单击餐厅图像时,它会显示名为成员窗口的 div。我得到的错误是Uncaught SyntaxError: Unexpected token {
.
这是一个单独的 JavaScript 文件上的脚本
$(document).ready(resteraunt(){
$('people').click(function(){
$("memberswindow").show();
});
});
这是HTML
<!DOCTYPE html>
<html>
<head> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="Wolfeboro_Connection/Scripts/homepage.js"></script>
<script src="Wolfeboro_Connection/Scripts/menu.js"></script>
<link rel='stylesheet' href='Wolfeboro_Connection/CSS/index.css'>
</head>
<body>
<img src="Wolfeboro_Connection/wc.png" id="wc">
<a href='' onclick='resteraunt();'><img src='Wolfeboro_Connection/resteraunt.jpg'
id="resteraunt"></a>
<a href='' onclick='map();'><img src='Wolfeboro_Connection/map.jpg' id="map"></a>
<a href='' onclick='mail();'><img src='Wolfeboro_Connection/mail.jpg' id="mail"></a>
<a href='' onclick='people();'><img src='Wolfeboro_Connection/people.jpg' id="people"></a>
<div id="window"> <div id="memberswindow"> <input type="text" id="username"
placeholder="Username">
<input type="text" id="loginpassword" placeholder="Password">
<input type="text" id="email" placeholder="Email"> </div> </div>
<div id="banner"> <h1> Wolfeboro Connection </h1> </div>
</body>
</html>