a href后面的参数如何根据输入动态改变
<a href="tencent://Message/?Uin=447524120&&websiteName=q-zone.qq.com&Menu=yes" title="fdfsa">发送消息</a>
Uin的值如何根据文本框输入动态改变,
不好意思,对ASP.NET不熟悉
------解决方案--------------------------------------------------------
可以用服务器端控件HyperLink
------解决方案--------------------------------------------------------
用js控制,给a 一个id ,然后通过document.getElementById(id)找到这个元素,修改它的href属性,再写就是字符串处理了,想必知道弄了
------解决方案--------------------------------------------------------
cs:
public string GetHref()
{
string href="<a href='tencent://Message/?Uin=" + this.txt1.text + "&websiteName=q-zone.qq.com&Menu=yes' title='fdfsa'>发送消息 </a>";
return href;
}
aspx:
<%=GetHref()%>
------解决方案--------------------------------------------------------
- HTML code
<html><head><script type="text/javascript"><!--function UpHref(h){ var str="tencent://Message/?Uin="+h+"&&websiteName=q-zone.qq.com&Menu=yes"; var d=document.getElementById("aid"); d.href=str;}--></script></head><body><a href="tencent://Message/?Uin=447524120&&websiteName=q-zone.qq.com&Menu=yes" id="aid" title="fdfsa">发送消息 </a><input type="text" onblur="UpHref(this.value)" /></body></html>
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<script type="text/javascript" >
function keyupit(sender)
{
var a = document.getElementById('test1');
if(a != null)
{
var url = "test.aspx?uin=";
url += sender.value;
url += "&websiteName=q-zone.qq.com&Menu=yes";
a.href = url;
}
}
</script>
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<a id="test1" href="test.aspx?uin=1&websiteName=q-zone.qq.com&Menu=yes">ffff</a>
<br />
<input id="txt" type="text" value="" onkeyup="keyupit(this)" /></div>
</form>
</body>
</html>
------解决方案--------------------------------------------------------
不用客气