求高手告诉一下为什么button中数据库的那个没有运行
button中的代码在eclipse中可以运行,而且在网页中alert("你好!");也有运行,为什么中间那段没运行了
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
   function button(){
      // document.getElementById('useraddL').submit();
       Class.forName("org.gjt.mm.mysql.Driver"); //驱动程序你自己的,我的是com.mysql.jdbc.Driver
	  String url="jdbc:mysql://localhost:3306/mysql";//你自己设置数据库名称  
	  Connection con=DriverManager.getConnection(url,"root",""); //如果你mysql中root的密码是空的话最好写成""代替null
	  String sql="insert into txt (name,password) values ('"+"bb"+"','"+"mm"+"')";//你使用的表是txt,sql建表自己看着办吧
	  Statement stmt=con.createStatement();  
	  stmt.executeUpdate(sql);
		  alert("你好!");
     }
   </script>
</head>
<body>
<form action="UsersServlet.do?action=doLogin" name="useraddL"
	id="useraddL" method="post">
<table class="midbox">
	<tr>
		<td class="namebox" colspan="2"><strong>『用户登录』</strong></td>
	</tr>
	<tr>
		<td>
	<c:if test="${result!=null}"><font color="red">${result}</font></c:if>
		<table>
			<tr>
				<td> 用 户 名 :</td>
				<td><input type="text" name="usernameR" id="usernameR" value="<%  
					//Cookie[] cookies = request.getCookies();
				 // for   (int i=0;i< cookies.length;i++)   {
					//  Cookie cookie=cookies[i];
					//  if(cookie.getName().equals("bbsName")){
					//  out.println(cookie.getValue());}
						//  }%>"/></td>
			</tr>
			<tr>
				<td> 密     码 :</td>
				<td><input type="password" name="passwordR" id="passwordR" value="<%  
				  //for   (int i=0;i< cookies.length;i++)   {
					//  Cookie cookie=cookies[i];
					//  if(cookie.getName().equals("bbsPassword")){out.println(cookie.getValue());}
						//  }%>"/></td>
			</tr>
			<tr>
				<td></td>
				<td><input type="checkbox" name="saveInfo" id="saveInfo" />保存登录信息
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
				 <button a href="http://selftest.chinaunix.net/" name="but" id="but" onclick="button();">登 陆</button>
				    <input href="http://selftest.chinaunix.net/" type="reset"
					value="重新填写"></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
<div class="blankline"></div>
</body>
</html>
------解决方案--------------------
 Class.forName("org.gjt.mm.mysql.Driver"); //驱动程序你自己的,我的是com.mysql.jdbc.Driver
String url="jdbc:mysql://localhost:3306/mysql";//你自己设置数据库名称 
Connection con=DriverManager.getConnection(url,"root",""); //如果你mysql中root的密码是空