现在想实现:TextBox中输入"A"(光标不离开输入框) 页面跳转到其他页面
解决方案 »
- [color=#FF0000]((Repeater)obj).[/color]为什么这么写?
- 字符串处理问题
- 在.net 2003里,怎样把自己的.cs文件全编译成.dll文件
- 求一个判断语句
- 請教高手!關於(03net安裝問題)!!
- 给分了,,希望大家提个建议~~!
- css的如何调用(.....................)在线等
- full join是什么意思?full join和full outer join有什么区别?有outer和没outer的链接有什么不同?
- MyGeneration生成NHibernate的类型怎么全是unkown类型啊??
- 请问:如何在a.xml中引用b.xml中的一个元素的值?
- 分不多,但问题有价值,请进
- 有关数据锁的问题
使用TextChanged方法就成啊~
<asp:TextBox id="TextBox1" runat="server" Height="24px" onkeyup="tourl()"></asp:TextBox> <script language="javascript">
function tourl()
{
var tex=document.getElementById("TextBox1");
if(tex.value=="A")
{
window.open("http://www.hao123.com")
}
}
</script>
详细点吧 谢谢
<input type="text" id="TextBox1" Height="24px" onkeyup="tourl()">
<script language="javascript">
function tourl()
{
var tex=document.getElementById("TextBox1");
if(tex.value=="A")
{
window.open("http://www.hao123.com")
}
}
</script>
第二种方法:用ASP.NET控件
<asp:TextBox id="TextBox1" runat="server" Height="24px" onkeyup="tourl()"></asp:TextBox> <script language="javascript">
function tourl()
{
var tex=document.getElementById("TextBox1");
if(tex.value=="A")
{
window.open("http://www.hao123.com")
}
}
</script>
在Page_Load代码中输入TextBox1.Attributes.add("onkeyup","tour1()");
---------------------------------------------------------------------
不需要,直接和我上面那样写就可以,虽然是红色的,但是IE支持
yourTextBox.Attributes["onkeyup"]="if(event.keyCode==65)window.location.href='"+yourUrl+"'";在文本框内任意位置,输入'A'则页面重定向。