datalist里的text:
<input type="text" id="txthuifu" style="color:Gray; width:420px; height:22px;" onfocus="onfocustxthf();" onblur="onblurtxthf();" value="回复" />我用JS方法来控制的
function onfocustxthf()
{
var txt=document.getElementById("txthuifu");
if(txt.value=="回复")
{
txt.value="";
txt.style.color="black";
txt.style.width="420px";
txt.style.height="45px";
}
}
function onblurtxthf()
{
var txt=document.getElementById("txthuifu");
if(txt.value=="")
{
txt.value="回复";
txt.style.color="gray";
txt.style.width="420px";
txt.style.height="22px";
}
}这样写的问题是只有datalist最上面的一个text有变化,其余的都没有变化,我怎样才能知道我点的是哪个text呢?
<input type="text" id="txthuifu" style="color:Gray; width:420px; height:22px;" onfocus="onfocustxthf();" onblur="onblurtxthf();" value="回复" />我用JS方法来控制的
function onfocustxthf()
{
var txt=document.getElementById("txthuifu");
if(txt.value=="回复")
{
txt.value="";
txt.style.color="black";
txt.style.width="420px";
txt.style.height="45px";
}
}
function onblurtxthf()
{
var txt=document.getElementById("txthuifu");
if(txt.value=="")
{
txt.value="回复";
txt.style.color="gray";
txt.style.width="420px";
txt.style.height="22px";
}
}这样写的问题是只有datalist最上面的一个text有变化,其余的都没有变化,我怎样才能知道我点的是哪个text呢?
解决方案 »
- petshop4.0 是小项目吗?还有更好的开源的东西吗?
- 在bs中怎么实现cs项目的网格表单录入功能?
- 如何在退出时候注销掉用户的信息啊。
- OleDbDataReader的问题
- 最简单的ViewState的用法(C#)马上结分
- 救命那!关于treeview。在我的机器可以用,为什么有个别人访问就提示tree.htc脚本找不到 ?!
- 兄弟门请教问题:这两个文件有什么关系,有什么不同?有什么好的方法可以修改主页!!而不用新建目录?
- asp.net 禁止用户返回历史页面
- 32位下asp.net2.0开发的程序如何升级到64位asp.net4.0呢?
- 请问如何设置使输出的csv文件的编码为GB2312
- 这里的事件委托是做什么用的?谢谢
- 求一个NavigateUrl解决方法,感激万分
把 JS 方法的声明改为需要接受一个参数,如:
function onfocustxthf(txt)
{
if(txt.value=="回复")
{
txt.value="";
txt.style.color="black";
txt.style.width="420px";
txt.style.height="45px";
}
}
是不是可以了?