为什么说querysql没定义啊
代码如下:
<%@page pageEncoding="utf-8"
contentType="text/html;charset=utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<script type="text/javascript" src="../js/jquery-1.4.3.js"></script>
<script type="text/javascript" >
<script>
function querysql() {
var sql =$("#sql").val();
alert("----");
jQuery.ajax({
url:"/Test/select.action",
data:{"sql":sql},
async:true,
dataType:"json",
cache:false,
success:function(data,textStatus){
if(data != undefined && data == "SQL语句有误请重新输入!") {
document.getElementById("resdisp").innerHTML = "SQL语句有误请重新输入!";
}else {
var str = "<table border='1px'>";
str += "<tr>";
if(data[0].id != 0) {
str += "<td>编号 </td>";
}
if(data[0].gameName != null) {
str += "<td>名称</td>";
}
if(data[0].rcmdImg != null) {
str += "<td>图片</td>";
}
str += "</tr>";
for(var i=0; i<data.length; i++) {
str += "<tr>";
if(data[i].id != 0) {
str += "<td>" + data[i].id + "</td>";
}
if(data[i].name != null) {
str += "<td>" + data[i].gameName + "</td>";
}
if(data[i].price != null) {
str += "<td>" + data[i].rcmdImg + "</td>";
}
str += "</tr>";
}
str += "</table>";
document.getElementById("resdisp").innerHTML = str;
}
}
});
}
</script>
<html>
<body>
登录成功。
<a href="list.action">显示游戏</a>
<form action="select.action" method="post">
<input type="text" id="sql" style="width:300px">
<input type="button" name="indicbutton" onclick="querysql();" value="确 定" id="indicbutton" />
<div id="resdisp">
</div>
</form>
</body>
</html>
------解决方案--------------------
<script type="text/javascript" >
<script>
多了一个<script> 标签?
------解决方案--------------------