当我点击留言按钮时,它不会调用alert()..可以查看代码吗?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Homepage</title>
<script type="text/javascript" src="lib/jquery/jquery-1.4.2.js"></script>
<script type="text/javascript" src="lib/jquery/jquery-ui-1.8.10.custom.min.js"></script>
<script type="text/javascript" src="lib/jquery/jquery.dmDropDownMenu.js"></script>
<script type="text/javascript" src="lib/jquery/watermark.js"></script>
<link rel="stylesheet" type="text/css" href="/jquery-ui-1.8.10.custom.css" />
<link rel="stylesheet" type="text/css" href="/stylez.css" />
<script type="text/javascript" /> $(document).ready( function(){ $('#buttons button').click(function(){ switch( $('buttons').id){ case "mail": alert(1); break; } }); }); </script>
</head>
<body>
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="columnA">
<div id="buttons">
<button id="mail" class="menubutton">Message</button><br/>
</div>
</td>
</tr>
</table>
</body>
</html>
答案 0 :(得分:2)
更改
$('buttons').id
到:
$('buttons').get(0).id
答案 1 :(得分:2)