关于一个JS脚本的简单问题??? 我想判断一个文本框当你不输入时弹出一个提示对话框。提醒你输入。并前文本框的背景颜色马上变为红色。以突出显示当前输入位置.. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if (document.getElementById("TextBox1").value=="") { alert("请输入!"); document.getElementById("TextBox1").style.backgroundColor ="red" } if (document.getElementById("TextBox1").value=="") { alert("请输入!"); document.getElementById("TextBox1").style="background:#933" ;document.getElementById("TextBox1").focus(); } if (document.getElementById("TextBox1").value=="") { alert("请输入!"); document.getElementById("TextBox1").style.backgroundColor ="red" document.getElementById("TextBox1").focus(); //最好是最后再让此文本框取得焦点 } <html> <head> </head> <body> 请输入:<input id="txt" name="txt" onBlur="doI()" /><script type="text/javascript" language="javascript"> function doI(){ var obj = document.getElementById("txt"); if (obj.value==""){ alert("请输入内容!"); obj.style.backgroundColor ="red" ; obj.focus(); } else{ obj.style.backgroundColor ="" ; }}</script> </body> </html> 谁提供个asp.net Ajax的护展控件包 如何使用executereader()返回count(*)的值并用label显示值 高分正则:找到匹配的元素,往其后加个后缀 刚听了一个水晶报表的讲座 但还是云里雾里 谁有入门教程 分享一下 谢谢 动态删除div问题,求解!!! 如何在 sql 查询时先把字段内容去除html标签后搜索 DataList 中套 GridView 上传文件后,中文全是乱码啦 請教DataBinder.Eval的使用 我想知道在线用户具体有那些? 页面跳转的问题 如何用 javascript 获得所以得 DropDownList 的 id
{
alert("请输入!");
document.getElementById("TextBox1").style.backgroundColor ="red"
}
{
alert("请输入!");
document.getElementById("TextBox1").style="background:#933" ;
document.getElementById("TextBox1").focus();
}
{
alert("请输入!");
document.getElementById("TextBox1").style.backgroundColor ="red"
document.getElementById("TextBox1").focus(); //最好是最后再让此文本框取得焦点
}
<head>
</head>
<body>
请输入:<input id="txt" name="txt" onBlur="doI()" />
<script type="text/javascript" language="javascript"> function doI(){
var obj = document.getElementById("txt");
if (obj.value==""){
alert("请输入内容!");
obj.style.backgroundColor ="red" ;
obj.focus();
}
else{
obj.style.backgroundColor ="" ;
}
}
</script>
</body>
</html>