给我一个示例代码? [英] give me a sample coding?

查看:133
本文介绍了给我一个示例代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写一个JavaScript文件来验证ASP页面中的文本字段?

how to write a javascript file to validate text field in asp page?

推荐答案

尝试使用jQuery:

Try using jQuery:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">


(document).ready(function(){ var textbox = document.getElementById('<% = TEXTBOX.ClientID %> '); var button = document.getElementById('<% = SEND.ClientID %> ');
(document).ready(function(){ var textbox = document.getElementById('<%= TEXTBOX.ClientID %>'); var button = document.getElementById('<%= SEND.ClientID %>');


(SEND).click(function(){ //在这里进行验证 }); }); < /script >
(SEND).click(function() { // do validation here }); }); </script>



上面的SEND是一个asp.net按钮控件.此处的逻辑是在单击发送"按钮后验证文本框.尝试学习jQuery.比javascript
更容易
供您参考:
http://www.w3schools.com/jquery/default.asp

最好的问候,
爱德华



the SEND above is an asp.net button control. The logic here is to validate the textbox upon clicking the SEND button. Try studying jQuery. Its easier than javascript

For your reference:
http://www.w3schools.com/jquery/default.asp

Best regards,
Eduard


这篇关于给我一个示例代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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