即不支持onblur和onfocus .pls给我即受支持的解决方案 [英] ie not supporting onblur and onfocus .pls give me ie supported solution

查看:65
本文介绍了即不支持onblur和onfocus .pls给我即受支持的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 var textbox = document.getElementById("textbox");
如果(textbox.value =="){
alert(您未在文本框中输入文本.请在提交表单之前输入.\ n");
textbox.focus();
返回false;
}

HTML-

<  输入    ="  文本框" 类型  文本"     =" 单击此处键入"  onfocus   ="     onblur   ="  >   


关于
...................

解决方案

亲爱的朋友,

我使用相同的方法,希望使用此方法.

 <  输入   类型  ="    名称  ="   onfocus       onBlur   ="      ="  >  



< script language = " >
函数 searchfield_focus(obj)
{
obj.style.color = " 
obj.style.fontStyle = " 
如果(obj.value == " )
{
obj.value = " 
}
}
函数 fun_return(obj)
{
如果(obj.value == <" )
{
obj.style.color = " 
obj.style.fontStyle = " 
obj.value = " 
}
}
</ 脚本   语言  =  "  javascript" var textbox= document.getElementById ("textbox");
if (textbox.value == "") {
alert("You did not enter text in the textbox. Please enter before submitting form. \n");
textbox.focus();
return false;
}

HTML -

<input name="textbox" type="text" value="Click here to type" onfocus="if(this.value=='Click here to type')this.value='';" onblur="if(this.value=='')this.value='Click here to type';">




Regarding
..........

解决方案

Dear Friend,

I use the same, use this hope it works.

<input type="text" name="filter" onfocus="searchfield_focus(this)" onBlur="fun_return(this)" value="Enter The Text To Search">



<script language="javascript">
function searchfield_focus(obj)
{
	obj.style.color=""
	obj.style.fontStyle=""
	if (obj.value=="Enter The Text To Search")
	{
		obj.value=""
	}
}
function fun_return(obj)
{
	if (obj.value=="")
	{
		obj.style.color="#808080"
		obj.style.fontStyle="italic"
		obj.value="Enter The Text To Search"
	}
}
</script language="javascript">



Regards,
AP


这篇关于即不支持onblur和onfocus .pls给我即受支持的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆