惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
N
Netflix TechBlog - Medium
Google Online Security Blog
Google Online Security Blog
月光博客
月光博客
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
M
MIT News - Artificial intelligence
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
The Cloudflare Blog
Blog — PlanetScale
Blog — PlanetScale
F
Full Disclosure
G
Google Developers Blog
罗磊的独立博客
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
A
About on SuperTechFans
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
GbyAI
GbyAI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
The Register - Security
The Register - Security
U
Unit 42
D
Docker
Martin Fowler
Martin Fowler
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
阮一峰的网络日志
阮一峰的网络日志
C
Cybersecurity and Infrastructure Security Agency CISA
博客园_首页
Google DeepMind News
Google DeepMind News

博客园 - Bobby

SQL Top注意事项 C#关于值类型和引用类型 Asp.Net XML操作基类(修改,删除,新增,创建) 项目中的代码 客户端全部选中或取消Repeater中的CheckBox - Bobby - 博客园 javascript技巧参考(转载) js倒计时关闭窗口&计算字数 - Bobby - 博客园 CSS控制GridView固定表头 - Bobby - 博客园 经典算法-C#四种排序算法 js设置调用cookie设置背景颜色 字号、颜色 js简繁转换代码 ASP.NET错误处理的方式(总结) ASP.NET错误处理和程序优化 学习SQL应知道的动态SQL语句基本语法 js宝典学习笔记【转载】 在b/s开发中经常用到的javaScript技术整理 Visual C#常用函数和方法集汇总 SQL SERVER 与ACCESS、EXCEL的数据转换 - Bobby 不被浏览器屏蔽的对联广告
asp.net回车提交表单 - Bobby - 博客园
Bobby · 2007-09-11 · via 博客园 - Bobby

ASP.NET页面按回车提交表单,前台页面

  <script type="text/javascript">
    
function check()
    
{
  
        
var theForm = document.forms['aspnetForm'];
   
 
        
if(theForm.ctl00$ContentPlaceHolder1$txtUserName.value=="")
        
{
            alert(
"请输入用户名!");
            theForm.ctl00$ContentPlaceHolder1$txtUserName.focus();
            
return false
        }
            
        
        
var myRegex = /@.*\.[a-z]{2,6}/;
        
var email = theForm.ctl00$ContentPlaceHolder1$txtUserName.value;
        email 
= email.replace(/^ | $/g,"");
        email 
= email.replace(/^\.*|\.*$/g,"");
        email 
= email.toLowerCase();        
       
        
if (!myRegex.test(email))
        
{
            alert (
"请输入有效的E-Mail!");
            theForm.ctl00$ContentPlaceHolder1$txtUserName.focus();
            
return false;
        }

    
        
if(theForm.ctl00$ContentPlaceHolder1$txtPassword.value=="")
        
{
            alert(
"请输入密码!");
            theForm.ctl00$ContentPlaceHolder1$txtPassword.focus();
            
return false;
        }

        
        
return true;
     
        
    }
 
    
    
function checksearch()
    
{
        
var Form = document.forms['aspnetForm'];
        
if(Form.ctl00$ContentPlaceHolder1$SearchText.focus)
        
{
            
if(Form.ctl00$ContentPlaceHolder1$SearchText.value=="")
            
{       
                alert(
"请输入关键字!");
                Form.ctl00$ContentPlaceHolder1$SearchText.focus();
                
return false;
            }

            
return true;   
        }

    }

    
</script>

后台:


          //添加属性,JS代码用来判断回车键
            SearchText.Attributes.Add("onkeydown", "if (event.keyCode == 13){aspnetForm.ctl00$ContentPlaceHolder1$btnSearch.click();return false;;return false;}");