代码如下
private void Btlogin_Click(object sender, System.EventArgs e)
{
......
string SQL="select count(*) from table where username='"+username+"'and password='"+password+"'";
.......
if (count(*)>0)
{
window.open("url");
}
else
{
response.write "错误"
}
}请问能实现吗
如果能,怎么写"window.open"这句
请大家帮助
谢谢!
private void Btlogin_Click(object sender, System.EventArgs e)
{
......
string SQL="select count(*) from table where username='"+username+"'and password='"+password+"'";
.......
if (count(*)>0)
{
window.open("url");
}
else
{
response.write "错误"
}
}请问能实现吗
如果能,怎么写"window.open"这句
请大家帮助
谢谢!
{
Response.Write("<script>window.open('url');</script>");
}另外提醒楼主一下:楼上的SQL查询代码有注入漏洞。
window.open()方法参数示例:
<form>
<div align="center"><input type="button" Value="打开新窗口"
ONCLICK="window.open('index.htm','Sample','toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=no,resizable=no,copyhistory=yes,width=300,height=200,left=100,top=100')">
</form> <!--说明:将其中的链接文件test.htm改为你的路径,窗口参数如下: toolbar=yes, 显示工具条
location=yes,显示网址栏
directories=no,导航条
status=no,状态条
menubar=yes,菜单
scrollbars=yes,滚动条
resizable=no,是否可以改变大小
copyhistory=yes,历史按钮
width=300,宽
height=200'高
left=1000,距离左边100
top=100,距离顶端100-->
我的目的是要执行 if (count(*)>0)
才能window.open