js 输入框边框变色问题 <input onfocus="javascript:this.cssText='border-color=#069'" id="add" name="add" /> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你试试下面的。<input type="text" name="user_id" id="user_id" size="36" maxlength="20" onMouseOver="fEvent('mouseover',this)" onMouseOut="fEvent('mouseout',this)" onFocus="fEvent('focus',this)" onBlur="checkedUser();fEvent('blur',this)" />function fEvent(sType,oInput){ switch (sType){ case "focus" : oInput.isfocus = true; oInput.style.backgroundColor='#C5FDFE'; case "mouseover" : oInput.style.borderColor = '#99E300'; break; case "blur" : oInput.isfocus = false; oInput.style.backgroundColor=""; case "mouseout" : if(!oInput.isfocus){ oInput.style.borderColor='#A1BCA3'; } break; } <input onfocus="javascript:this.style.borderColor='#069'" id="add" name="add" /> this.style.borderColorborderColor是CSS样式中的,必须通过style对象来引用。 关于DHTML,建议下本手册,中间会有详细的解释。或者MSDN中就直接有。 <input onfocus="javascript:this.style.borderColor='#069';" id="add" name="add" /> 正解!在js中的属性和css中的写法不一定是一样的 ===========在JS中查找文本框中的文字并选中========= 如何使一张网页呈现三维立体感 js 取得table中的行号 javaScript取Select控件的值时发生了错误,求帮助! 一个很怪的问题:jquery在本地不能运行,在远程就可以??? jquery input 只显示一次的问题? select onchange没用 有哪位兄弟能做跨越框架的JS菜单且方便重新定制? 用Javascript和DHTML构建的矢量图形库,更多Javascript资源 请问JAVASCRIPT如何调用COM对象? 排序问题? JavaScript不显示
<input type="text" name="user_id" id="user_id" size="36" maxlength="20" onMouseOver="fEvent('mouseover',this)" onMouseOut="fEvent('mouseout',this)" onFocus="fEvent('focus',this)" onBlur="checkedUser();fEvent('blur',this)" />function fEvent(sType,oInput){
switch (sType){
case "focus" :
oInput.isfocus = true;
oInput.style.backgroundColor='#C5FDFE';
case "mouseover" :
oInput.style.borderColor = '#99E300';
break;
case "blur" :
oInput.isfocus = false;
oInput.style.backgroundColor="";
case "mouseout" :
if(!oInput.isfocus){
oInput.style.borderColor='#A1BCA3';
}
break;
}
或者MSDN中就直接有。