Jquery telerik输入控件上的onkeyup客户端事件问题
我想在键入时将textbox文本属性复制到另一个文本属性(应该完全相同)…Jquery telerik输入控件上的onkeyup客户端事件问题,jquery,asp.net,telerik,client-side,onkeyup,Jquery,Asp.net,Telerik,Client Side,Onkeyup,我想在键入时将textbox文本属性复制到另一个文本属性(应该完全相同)… 因此,请参见以下代码(复制、粘贴并测试): 字段集 { 宽度:300px; } 传奇 { 颜色:蓝色; } 弹起 键盘按下 按键 电传键控 函数onkeyup_TextBox1(){ $('#TextBox2').val($('#TextBox1').val()); } 函数onkeydown_TextBox3(){ $('#TextBox4').val($('#TextBox3').val());
因此,请参见以下代码(复制、粘贴并测试):
字段集
{
宽度:300px;
}
传奇
{
颜色:蓝色;
}
弹起
键盘按下
按键
电传键控
函数onkeyup_TextBox1(){
$('#TextBox2').val($('#TextBox1').val());
}
函数onkeydown_TextBox3(){
$('#TextBox4').val($('#TextBox3').val());
}
功能onkeypress_TextBox5(){
$('#TextBox6').val($('#TextBox5').val());
}
函数onkeyup\u RadNumericTextBox1(){
var RadNumericTextBox1=$find(“”);
var RadNumericTextBox2=$find(“”);
RadNumericTextBox2.set_值(RadNumericTextBox1.get_值());
}
编辑就我而言,常规asp.net文本框控件上的onkeyup事件是正常的。。。 但它有时在telerik输入控制中不起作用!(onkeyup语法没有问题,只是在第一个文本框中键入时,另一个文本框少了1个字符,为什么?) 执行此操作时,telerik输入控件应使用哪个事件
提前感谢这是特定于浏览器的问题吗?如果是的话,常规文本框在同一浏览器中的行为如何?亲爱的迪克,我用FF和IE(同样的方式)测试上面的代码。。。我也编辑我的Q!真的很奇怪,不要说任何可能导致这种情况的话,除非事先做了某种修整。不过谢谢大家的关注。。。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="keyup.Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!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 src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<style type="text/css">
fieldset
{
width:300px;
}
legend
{
color:Blue;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<div>
<fieldset>
<legend>keyup</legend>
<asp:TextBox ID="TextBox1" runat="server" onkeyup="onkeyup_TextBox1();"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</fieldset>
<br />
<br />
<fieldset>
<legend>keydown</legend>
<asp:TextBox ID="TextBox3" runat="server" onkeydown="onkeydown_TextBox3();"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</fieldset>
<br />
<br />
<fieldset>
<legend>keypress</legend>
<asp:TextBox ID="TextBox5" runat="server" onkeypress="onkeypress_TextBox5();"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
</fieldset>
<br />
<br />
<fieldset>
<legend>Telerik - keyup</legend>
<telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" DataType="System.Int32"
onkeyup="onkeyup_RadNumericTextBox1();">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
<br />
<telerik:RadNumericTextBox ID="RadNumericTextBox2" runat="server"
DataType="System.Int32" Culture="fa-IR" Width="125px">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
</fieldset>
</div>
<script type="text/javascript">
function onkeyup_TextBox1() {
$('#TextBox2').val($('#TextBox1').val());
}
function onkeydown_TextBox3() {
$('#TextBox4').val($('#TextBox3').val());
}
function onkeypress_TextBox5() {
$('#TextBox6').val($('#TextBox5').val());
}
function onkeyup_RadNumericTextBox1() {
var RadNumericTextBox1 = $find("<%= RadNumericTextBox1.ClientID %>");
var RadNumericTextBox2 = $find("<%= RadNumericTextBox2.ClientID %>");
RadNumericTextBox2.set_value(RadNumericTextBox1.get_value());
}
</script>
</form>
</body>
</html>