如1.aspx中有以下链接,想让它把当前页的textbox的值传到2.aspx中去搜索,如果办?
<a href="2.aspx" target="_blank">搜索</a>
注意一定要用a标签或HyperLink,主要是我想使用a标签的target="_blank"属性。
有朋友解决了,用的是以下方法:
<!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><title>
无标题页
</title>
<script language="javascript">
function test()
{
var value = document .getElementById ("txt").value ;
document .getElementById ("a").href = "2.aspx?id="+value ;
}
</script></head>
<body>
<form name="Form1" method="post" action="default.aspx" id="Form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTM4NjAwMjE2OGRkDxTkRJH/w+VUv/vqIACFzzQYmDc=" />
</div> <div>
<a href="#" id="a" target="_blank" onclick ="test();">搜索</a>
<input type ="text" id="txt" />
<script language="javascript">
function test()
{
var value = document .getElementById ("txt").value ;
document .getElementById ("a").href = "2.aspx?id="+value ;
}
</script>
<a href="#" id="a" target="_blank" onclick ="test();">搜索</a>
<input type ="text" id="txt" />
</div> </form>
</body>
</html>非常感谢,可是在用户控件中使用却出错,如何办?
<a href="2.aspx" target="_blank">搜索</a>
注意一定要用a标签或HyperLink,主要是我想使用a标签的target="_blank"属性。
有朋友解决了,用的是以下方法:
<!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><title>
无标题页
</title>
<script language="javascript">
function test()
{
var value = document .getElementById ("txt").value ;
document .getElementById ("a").href = "2.aspx?id="+value ;
}
</script></head>
<body>
<form name="Form1" method="post" action="default.aspx" id="Form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTM4NjAwMjE2OGRkDxTkRJH/w+VUv/vqIACFzzQYmDc=" />
</div> <div>
<a href="#" id="a" target="_blank" onclick ="test();">搜索</a>
<input type ="text" id="txt" />
<script language="javascript">
function test()
{
var value = document .getElementById ("txt").value ;
document .getElementById ("a").href = "2.aspx?id="+value ;
}
</script>
<a href="#" id="a" target="_blank" onclick ="test();">搜索</a>
<input type ="text" id="txt" />
</div> </form>
</body>
</html>非常感谢,可是在用户控件中使用却出错,如何办?
解决方案 »
- 请问:在ASPX里,像Asp中的RS.UPDATE语句来更新数据的代码是怎样的?
- 各位高手怎样解决
- 如何用IE自带的ActiveX控件(WebBrowser)实现Web打印?
- SQL问题``请哪位大吓帮帮忙啊``急
- 在.NET中新建项目时遇到的问题~急~~!
- 请大家帮个忙
- 有关重新绑定的问题
- 运行中找不到文件或程序集名称"Microsoft.Web.UI.WebControls.resources"是怎么回事??在线等
- 3.在企业级项目中如何调试Asp.net的WEB项目,怎样将DEFAULT.ASPX设为首页?
- 急救请大家帮帮我啊
- 高手请帮忙,关于调查问卷的问题
- vs2008 RequiredFieldValidator控件
若使用asp.net控件 将ID改为:WebUserControl1_TextBox1
其中WebUserControl1为用户控件的ID
{
var value = document .getElementById ("WebUserControl1_TextBox1").value ;
document .getElementById ("a").href = "2.aspx?id="+value ;
}
用var value = document .getElementById ("<%=txt.ClientID%>").value ;