如网页有控件
1 2 3 4 5 6 7 8 9 0然后有两个文本框
T1 T2
当我的鼠票在T1时 点击控件1就把1赋值给T1
当我的鼠票在T2时 点击控件1就把1赋值给T2谢谢
1 2 3 4 5 6 7 8 9 0然后有两个文本框
T1 T2
当我的鼠票在T1时 点击控件1就把1赋值给T1
当我的鼠票在T2时 点击控件1就把1赋值给T2谢谢
解决方案 »
- [开源框架分享]CYQ.Data 开源数据层框架 使用视频
- 问两个快捷键,谢谢!
- datagrid里怎么显示 超连接图片?
- 请问:如何打开一个新浏览器窗口来打开指定的页面?
- 【求助】GridView怎样在连接列里,显示的为一个内容,但是点击之后连接的为一个网站,而不是显示的内容,详细里面说。
- 谁能帮我解释一下这个句话是什么意思:DataBinder.Eval(Container.DataItem,"SomeValue").ToString()
- asmx文件上传到服务器的问题
- 为什么<a href="测试下载.zip"></a> 一点就说无法显视呢?
- 求助!!!关于aspnet用户登陆失败的问题
- 哪位仁兄或仁姐比较有耐心,帮我看看这个小问题
- listbox如何绑定数据
- 一个Web用户控件中js的问题,分不够另开帖给
楼主要实现你的功能 应该用一个 隐藏框 在焦点到t1时候保存 id为t1
点击你的控件1时候 根据这个隐藏框来 赋值给t1或t2
this.L1.Attributes.Add("onmouseout","document.all.T1.value='';document.all.T2.value=''");
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Test</title>
<script language="javascript">
var focusText;
function textOnFocus(id)
{
focusText=id;
}
function btClick(str)
{
if(focusText!=null)
{
document.getElementById(focusText).value=str;
}
}
</script>
</head><p>
<input name="bt1" type="button" value="1" id="bt1" onclick="btClick(this.value);"/>
<input name="bt2" type="button" value="2" id="bt2" onclick="btClick(this.value);"/>
<input name="bt3" type="button" value="3" id="bt3" onclick="btClick(this.value);"/>
<input name="bt4" type="button" value="4" id="bt4" onclick="btClick(this.value);"/>
<input name="bt5" type="button" value="5" id="bt5" onclick="btClick(this.value);"/>
<input name="bt6" type="button" value="6" id="bt6" onclick="btClick(this.value);"/>
<input name="bt7" type="button" value="7" id="bt7" onclick="btClick(this.value);"/>
<input name="bt8" type="button" value="8" id="bt8" onclick="btClick(this.value);"/>
<input name="bt9" type="button" value="9" id="bt9" onclick="btClick(this.value);"/>
<input name="bt0" type="button" value="0" id="bt0" onclick="btClick(this.value);"/></p>
<p><input name="t1" id="t1" type="text" onfocus="textOnFocus(this.id);"/>
<input name="t2" id="t2" type="text" onfocus="textOnFocus(this.id);"/>
</p><body>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<script type="text/javascript">
<!--
function focusID(_ID)
{
//安装楼主意思是鼠标悬停 应该是onmouseover 但是对于实际操作应该onfocus更适合
document.getElementById('curTID').value = _ID;
}
function setText(val)
{
var txtID = document.getElementById('curTID').value;
document.getElementById(txtID).value = val;
}
//-->
</script>
</head> <body>
T1: <input type="text" id="t1" onmouseover="focusID(this.id);" /><br />
T2: <input type="text" id="t2" onmouseover="focusID(this.id);" /><input type="hidden" id="curTID" value="" /><br />
<input type="button" id="btn01" value="test1" onclick="setText(this.value);" /><br />
<input type="button" id="btn02" value="test2" onclick="setText(this.value);"/><br />
<input type="button" id="btn03" value="test3" onclick="setText(this.value);"/><br />
<input type="button" id="btn04" value="test4" onclick="setText(this.value);"/>......<br />
</body>
</html>