<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="jobs_Default3" %><!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 language="javascript" type="text/javascript">
var txtTestValue
function GetUrl1()
{
if( document.getElementById("ddlTest1").SelectedIndex == "0" )
{
txtTestValue ="&getTXT=" & document.getElementById("TextBox1").value;
document.getElementById("myhref").href="aaa.aspx?id=" + txtTestValue ;
}
else ( document.getElementById("ddlTest1").SelectedIndex == "1" )
{
txtTestValue = "";
document.getElementById("myhref").href="aaa.aspx?id=" + txtTestValue;
}
} </script>
</head>
<body>
<form runat="server" id="form1" method="post" enctype="multipart/form-data">
<div>
<a href='' id="myhref" name="myhref" onmouseover="GetUrl1()">链接</a><br />
<asp:RadioButtonList ID="ddlTest1" runat="server" ForeColor="Fuchsia"
RepeatDirection="Horizontal" Width="152px" EnableViewState="true" >
<asp:ListItem Selected="True">选择1</asp:ListItem>
<asp:ListItem Text="false">选择2</asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="TextBox1" runat="server" Width="110px"></asp:TextBox>
</div>
</form>
</body>
</html>1、后台有个公共变量publicstring,假设publicstring="ID1234"
2、前台网页通过js获得变量txtTestValue (如上),
当选择1时就txtTestValue就获取textbox里的值,当选择2时txtTestValue =""空值,再使txtTestValue 与publicstring接起来,即是想publicstring & txtTestValue 然后使用document.getElementById("myhref").href="aaa.aspx?id=" + publicstring & txtTestValue 如何实现我想要的.
<head id="Head1" runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
var txtTestValue
function GetUrl1()
{
if( document.getElementById("ddlTest1").SelectedIndex == "0" )
{
txtTestValue ="&getTXT=" & document.getElementById("TextBox1").value;
document.getElementById("myhref").href="aaa.aspx?id=" + txtTestValue ;
}
else ( document.getElementById("ddlTest1").SelectedIndex == "1" )
{
txtTestValue = "";
document.getElementById("myhref").href="aaa.aspx?id=" + txtTestValue;
}
} </script>
</head>
<body>
<form runat="server" id="form1" method="post" enctype="multipart/form-data">
<div>
<a href='' id="myhref" name="myhref" onmouseover="GetUrl1()">链接</a><br />
<asp:RadioButtonList ID="ddlTest1" runat="server" ForeColor="Fuchsia"
RepeatDirection="Horizontal" Width="152px" EnableViewState="true" >
<asp:ListItem Selected="True">选择1</asp:ListItem>
<asp:ListItem Text="false">选择2</asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="TextBox1" runat="server" Width="110px"></asp:TextBox>
</div>
</form>
</body>
</html>1、后台有个公共变量publicstring,假设publicstring="ID1234"
2、前台网页通过js获得变量txtTestValue (如上),
当选择1时就txtTestValue就获取textbox里的值,当选择2时txtTestValue =""空值,再使txtTestValue 与publicstring接起来,即是想publicstring & txtTestValue 然后使用document.getElementById("myhref").href="aaa.aspx?id=" + publicstring & txtTestValue 如何实现我想要的.
解决方案 »
- 弹出模态对话框后,在模态对话框内下载文件失败
- 求一个正则表达式
- 【问题】关于一个常见的div布局问题(顶着有分)
- 动态创建一个TXT文件,写入数据,并给用户下载
- 在asp.net中,怎么实现Repeater的分页呢?!!
- 与项目经验有关的问题,做过统计的人也可以来看看,答对给10分
- JS关闭IE弹出提示
- aspnet_wp.exe进程回收问题??设置machine.config文件的属性responseDeadlockInterval不起作用是什么原因呀??
- sitemap的问题,初学求教
- asp.net死锁如何解决,急!
- gridview中 HyperLinkField 在代码中定义DataNavigateUrlFormatString 出了问题
- 请高手来解决:在一个网页中放了一个分页控件,怎么获取分页的页码?
var publicstring=<%=publicstring%>;
TextBox1.Text = publicString
<title> 无标题页 </title>
<script language="javascript" type="text/javascript">
var txtTestValue
function GetUrl1()
{
var rd1 = document.getElementById("rad1");
var rd2 = document.getElementById("rad2");
var txt = document.getElementById("TextBox1");
var myhref = document.getElementById("myhref");
alert(txt.value);
if(rd1.checked == true)
{
myhref.href = "aaa.aspx?id="+txt.value;
}
else
{
//txt.value = "";
myhref.href = "aaa.aspx?id=";
}
alert(myhref.href);
}
</script>
</head>
<body>
<form runat="server" id="form1" method="post" enctype="multipart/form-data">
<a id="myhref">URL</a>
<asp:RadioButton ID="rad1" runat="server" GroupName="rd1" onclick="GetUrl1()" Text="选择1" />
<asp:RadioButton ID="rad2" runat="server" GroupName="rd1" onclick="GetUrl1()" Text="选择2" />
<br />
<asp:TextBox ID="TextBox1" runat="server" Width="110px"> </asp:TextBox>
</form>
</body>
</html>
是不是这里的问题?txtTestValue ="&getTXT= &" document.getElementById("TextBox1").value;
var txtTestValue;
function GetUrl1()
{
if(document.getElementById("ddlTest1").value == "0")
{
txtTestValue ="&getTXT=" + document.getElementById("TextBox1").value;
document.getElementById("myhref").href="aaa.aspx?id=" + <%= publicstring%> + txtTestValue ;
}
else (document.getElementById("ddlTest1").value == "1")
{
txtTestValue = "";
document.getElementById("myhref").href="aaa.aspx?id=" + <%= publicstring%> + txtTestValue;
}
} </script>
还有,JS里面的连接符不是&,是+,部分代码如下面:
txtTestValue ="&getTXT=" + document.getElementById("TextBox1").value;
试下
var txtTestValue= '<%=publicstring%>';