前台代码如下
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="query2.aspx.cs" Inherits="query2" %><!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 runat="server">
<title></title>
<script type="text/javascript">
function SearchAll1(cata) {
var strkey = document.getElementById("tkey").value;
var href = "/query2.aspx?cata=" + cata + "&key=" + strkey;
window.location.href = href;
}
</script>
</head>
<body >
<form id="form1" >
<input id="tkey" name="tkey" type="text" />
<button id="search" onclick="SearchAll1('all')"></button>
</form>
</body>
</html>
后台代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class query2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string url = Request.RawUrl;
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="query2.aspx.cs" Inherits="query2" %><!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 runat="server">
<title></title>
<script type="text/javascript">
function SearchAll1(cata) {
var strkey = document.getElementById("tkey").value;
var href = "/query2.aspx?cata=" + cata + "&key=" + strkey;
window.location.href = href;
}
</script>
</head>
<body >
<form id="form1" >
<input id="tkey" name="tkey" type="text" />
<button id="search" onclick="SearchAll1('all')"></button>
</form>
</body>
</html>
后台代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class query2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string url = Request.RawUrl;
}
}
解决方案 »
- 怎样在WINFORM窗体中不用水晶报表用按钮来实现打印功能?
- 资源访问权限(具体如下)在线
- rdlc报表:定义了报表参数,如何给它赋值呢?
- 谁能提供一个较好的asp.net登录页面源码?
- 在asp.net2.0中 如何判断WebPart控件在哪个WebPartZone里面啊?程序怎么写啊?
- 透明动画会遮住文本框,咋办?
- 为什么如此简单的问题把我搞得这样郁闷,100分求解~~~~~~~~~
- 如何用C#(or other languages)建立一个在客户端运行的能调用web service 的web控件?
- 询问一下这个正则表达是怎么写?
- 关于字符串长度
- 谁给我讲一下支付宝接口的问题呢
- 关于 统计 报表统计 问题~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var href = "/query2.aspx?cata=" + cata + "&key=" + strkey;
window.location.href = href;script中的这个跳转是同一个页面吗?
我的也是IE8 测试没问题
点击按钮最后得的值是 url = /3274/query2.aspx?tkey=%E6%B5%8B%E8%AF%95
有问题?这样不就可以取到你要的参数了吗!
你用button,默认是提交页面的表单了,同时点击的时候有激发了searchall这个过程,又提交了一次