就是我写了这么一段代码,我想实现的是:这有一个文本框,有一个按钮;当界面加载完毕,会显示数据库中的数据表格A,当我在文本框中输入完字符 点击按钮后,他会刷新界面这个表格A让它显示另一些数据,就是所谓的关键词查找啊,
但现在的问题是,界面加载不进去,它提示说我格式不对,可是我这块为了让他“格式对”我都已经给value3赋了一个值1,结果这个值还是不对,
而且我这个函数明明是等我点完按钮再调用,结果在界面加载时就调用了
在网上找了很久 但又不想放弃这个方向..可实在找不到更多相关的信息了
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="副本 从后台添加表格V2.aspx.cs" Inherits="CC测试文件2_从后台添加表格" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
function callvalue()
{
value = document.form1.xx.item(document.form1.xx.selectedIndex).text;
//sendvalue.Value = sendvalue.Text;
value2 = document.getElementById("sendvalue").value;
//Sid = Clng(sendvalue.Value);
//Sid = Long.parseLong(sendvalue.Value);
if (value == 'id')
{
//CLng clong=new CLng();
document.getElementById("Text1").value = Number(value2);
//value3 = document.getElementById("Text1").value;
value3 = Number(1);
s1.innerHTML = "<%Website.Model.Customer customer = Website.DAL.CustomerDAL.GetById("+value3+");%><tr><td><%=customer.cust_name%></td></tr></table>";
}
//form1.submit();跳转刷新
}
</script>
</head>
<body>
<form name="form1">
<select size="1" name="xx">
<option value="1">取值1</option>
<option value="2">id</option>
</select>
<input type=text id="sendvalue" name="sendvalue"/>
<input type=text id="Text1" name="Text1"/>
<input type=button name="clickmeToSubmit" value="clickme" onclick="callvalue()"/>
</form>
<div id="s1">
<table><%Website.Model.Class[] clas3 = Website.DAL.ClassDAL.GetAll();%><%for (int i = 0; i < clas3.Length; i++){%><tr><td><%=clas3[i].c_id%></td><td><%=clas3[i].c_name%></td></tr><%}%></table>
</div>
</body>
</html>