在input文本框中能否加入像在<img>中加alt一样显示出的浮动提示框。 <input type=text value="alt test" title="this is a test">用title属性就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在input文本框中能否加入像在<img>中加alt一样显示出的浮动提示框。 在文本框中默认状态下是空白的。鼠标移上去显示浮动提示框。像在<img>中加alt一样显示出的浮动提示框。不知有没有办法。 页面中如果有两个文本框,能不能在不用鼠标的情况下,用Tab键移动光标到第二个文本框。在有光标的文本框中出现提示呢?客户要求高啊!大家帮帮忙! 参考:<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>鼠标提示</title><script language="JavaScript">function seashowtip(tips,flag,iwidth){var my_tips=document.all.mytips;if(flag){ my_tips.innerHTML=tips; my_tips.style.display=""; my_tips.style.width=iwidth; my_tips.style.left=event.clientX+10+document.body.scrollLeft; my_tips.style.top=event.clientY+10+document.body.scrollTop; }else { my_tips.style.display="none"; }}</script><style>body{font-size:12px}</style><div id=mytips style="position:absolute;background-color:#ffffff;width:121;height:16;border:1px solid gray;display:none;filter: progid:DXImageTransform.Microsoft.Shadow(color=#999999,direction=135,strength=3); left:0; top:5"></div></head><body><form name="form1" method="post" action=""> 用户名: <input type="text" name="textfield" tips="*** 输入用户名." onmousemove=seashowtip(this.tips,1,150) onmouseout=seashowtip(this.tips,0,150)> <br/> 密 码: <input type="text" name="textfield2" tips="*** 输入密码." onmousemove=seashowtip(this.tips,1,150) onmouseout=seashowtip(this.tips,0,150)> <br/> 验证码: <input type="text" name="textfield3" tips="*** 输入验证码." onmousemove=seashowtip(this.tips,1,150) onmouseout=seashowtip(this.tips,0,150)> <input type="submit" name="Submit" value="提交"></form></body></html> 像TITLE这样的提示像是移动鼠标才激发的,要是这样,还是自己作一个提示的DIV,然后自己控件它在焦点的旁边显示,并且有时就显示不时不显示 <script> function cls(){ //捕获触发事件的对象,并设置为以下语句的默认对象 with(event.srcElement) //如果当前值为默认值,则清空 if(value==defaultValue) value="" } function res(){ //捕获触发事件的对象,并设置为以下语句的默认对象 with(event.srcElement) //如果当前值为空,则重置为默认值 if(value=="") value=defaultValue } </script> <input value="填写您的昵称" onfocus="cls()" onblur="res()"> <input value="填写您的生日(1900-01-01)" onfocus="cls()" onblur="res()">--------------------------------------请问怎样把上面改成文本框默认为空。插入光标是有提示,光标移出时清空文本框。 <script> function cls(){ //捕获触发事件的对象,并设置为以下语句的默认对象 with(event.srcElement) //如果当前值为默认值,则清空 if(value==event.srcElement.defaultValue) value="" } function res(){ //捕获触发事件的对象,并设置为以下语句的默认对象 with(event.srcElement) //如果当前值为空,则重置为默认值 if(value=="") value=event.srcElement.defaultValue } </script> <input value="填写您的昵称" defaltValue="填写您的昵称" onfocus="cls()" onblur="res()"> <input value="填写您的生日(1900-01-01)" defaltValue="填写您的生日(1900-01-01)" onfocus="cls()" onblur="res()" 把value去掉<script> function cls(){ //捕获触发事件的对象,并设置为以下语句的默认对象 with(event.srcElement) //如果当前值为默认值,则清空 if(value==event.srcElement.defaultValue) value="" } function res(){ //捕获触发事件的对象,并设置为以下语句的默认对象 with(event.srcElement) //如果当前值为空,则重置为默认值 if(value=="") value=event.srcElement.defaultValue } </script> <input defaltValue="填写您的昵称" onfocus="cls()" onblur="res()"> <input defaltValue="填写您的生日(1900-01-01)" onfocus="cls()" onblur="res()" http://community.csdn.net/Expert/topic/4379/4379684.xml?temp=.8149225 不行啊!把value去掉里面的提示就出不来拉。不把value去掉默认就会有提示。光标移出后两文本框的提示都出现了。我是想改成文本框默认为空。插入光标时有提示,只有在插入光标的文本框中才有提示,没有插入光标的不提示,移出时清空所有文本框。 哦,加上select就好了。<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>Untitled</title><script> function cls(){ with(event.srcElement) if(value==name) value="" }function res(){ with(event.srcElement) if(value=="") value=name event.srcElement.select();} </script></head><body>Hello World!<Form><input type="textbox" value="" onfocus="res();" onblur="cls()" size="40" name="填写您的昵称"> <br/><input type="textbox" value="" onfocus="res()" onblur="cls()" size="40" name="填写您的生日(1900-01-01)"> <br/></Form></body></html>你想要鼠标的,添加onmousedown事件就可以了。测试环境:2000ProIE6.0 使用Dreamweaver8写JavaScript问题 我有一个很急的问题求代码(动态图象的问题) 利用WEB打印能不能得到打印的页数??? 如何用ASP+JS开发自定义打印报表(添加、删除行列,合并、拆分单元格)? help在线等待(超级简单,嘿嘿) 不分大小写比较??? EJB和JAVABAEN有什么区别呢?? 请问如何得到当前帧的序号? 关于光标指定闪烁位置。 象这种压缩的代码,如何还原成没有压缩前的可读状态 如何在WEB里一直按住一个按钮,让文本框里的数字持续自增???谢谢啦 在不用鼠标的情况下,用Tab键移动光标到第二个文本框。怎样在插入光标的文本框中出现提示呢?
在文本框中默认状态下是空白的。鼠标移上去显示浮动提示框。像在<img>中加alt一样显示出的浮动提示框。不知有没有办法。
客户要求高啊!大家帮帮忙!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>鼠标提示</title>
<script language="JavaScript">
function seashowtip(tips,flag,iwidth){
var my_tips=document.all.mytips;
if(flag){
my_tips.innerHTML=tips;
my_tips.style.display="";
my_tips.style.width=iwidth;
my_tips.style.left=event.clientX+10+document.body.scrollLeft;
my_tips.style.top=event.clientY+10+document.body.scrollTop;
}
else
{
my_tips.style.display="none";
}
}
</script>
<style>
body{font-size:12px}
</style>
<div id=mytips style="position:absolute;background-color:#ffffff;width:121;height:16;border:1px solid gray;display:none;filter: progid:DXImageTransform.Microsoft.Shadow(color=#999999,direction=135,strength=3); left:0; top:5"></div>
</head>
<body>
<form name="form1" method="post" action="">
用户名:
<input type="text" name="textfield" tips="*** 输入用户名." onmousemove=seashowtip(this.tips,1,150) onmouseout=seashowtip(this.tips,0,150)>
<br/>
密 码:
<input type="text" name="textfield2" tips="*** 输入密码." onmousemove=seashowtip(this.tips,1,150) onmouseout=seashowtip(this.tips,0,150)>
<br/>
验证码:
<input type="text" name="textfield3" tips="*** 输入验证码." onmousemove=seashowtip(this.tips,1,150) onmouseout=seashowtip(this.tips,0,150)>
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>
还是自己作一个提示的DIV,然后自己控件它在焦点的旁边显示,并且有时就显示不时不显示
function cls(){
//捕获触发事件的对象,并设置为以下语句的默认对象
with(event.srcElement)
//如果当前值为默认值,则清空
if(value==defaultValue) value=""
}
function res(){
//捕获触发事件的对象,并设置为以下语句的默认对象
with(event.srcElement)
//如果当前值为空,则重置为默认值
if(value=="") value=defaultValue
}
</script>
<input value="填写您的昵称" onfocus="cls()" onblur="res()">
<input value="填写您的生日(1900-01-01)" onfocus="cls()" onblur="res()">
--------------------------------------
请问怎样把上面改成文本框默认为空。插入光标是有提示,光标移出时清空文本框。
function cls(){
//捕获触发事件的对象,并设置为以下语句的默认对象
with(event.srcElement)
//如果当前值为默认值,则清空
if(value==event.srcElement.defaultValue) value=""
}
function res(){
//捕获触发事件的对象,并设置为以下语句的默认对象
with(event.srcElement)
//如果当前值为空,则重置为默认值
if(value=="") value=event.srcElement.defaultValue
}
</script>
<input value="填写您的昵称" defaltValue="填写您的昵称" onfocus="cls()" onblur="res()">
<input value="填写您的生日(1900-01-01)" defaltValue="填写您的生日(1900-01-01)" onfocus="cls()" onblur="res()"
<script> function cls(){
//捕获触发事件的对象,并设置为以下语句的默认对象
with(event.srcElement)
//如果当前值为默认值,则清空
if(value==event.srcElement.defaultValue) value=""
}
function res(){
//捕获触发事件的对象,并设置为以下语句的默认对象
with(event.srcElement)
//如果当前值为空,则重置为默认值
if(value=="") value=event.srcElement.defaultValue
}
</script> <input defaltValue="填写您的昵称" onfocus="cls()" onblur="res()">
<input defaltValue="填写您的生日(1900-01-01)" onfocus="cls()" onblur="res()"
<head>
<title>Untitled</title>
<script>
function cls(){
with(event.srcElement)
if(value==name) value=""
}function res(){
with(event.srcElement)
if(value=="") value=name
event.srcElement.select();
}
</script>
</head><body>
Hello World!
<Form>
<input type="textbox" value="" onfocus="res();" onblur="cls()" size="40" name="填写您的昵称"> <br/>
<input type="textbox" value="" onfocus="res()" onblur="cls()" size="40" name="填写您的生日(1900-01-01)"> <br/>
</Form>
</body>
</html>你想要鼠标的,添加onmousedown事件就可以了。测试环境:
2000Pro
IE6.0