日期:2014-05-18  浏览次数:20440 次

求AJAX异步无刷新
在页面上输入随机验证码的时候,可以点击一个linkbutton刷新验证码,这应该是采用的AJAX异步无刷新技术吧,今天刚刚下了个AJAX组件,不过还不知道怎么用,谁能给讲一下,最好有代码,谢谢!!

------解决方案--------------------
<script type= "text/javascript " language= "javascript ">
//验证码更新开始

function newverifypic()
{
var timenow = new Date().getTime();
url= "ValidateCode.aspx "; //指向验证码页面
id = url.indexOf( '? ');
if(id > = 0 ){
if(id == (url.length-1))
url = url + "t= "+ timenow;
else
url = url + "&t= "+ timenow;
}else{
url = url + "?t= "+ timenow;
}
document.getElementById( "verifypic ").src=url; //显示验证码的image控件的ID
}
//验证码更新结束

</script>


<div class= "x-form-item ">
<label for= "yzm "> &nbsp;&nbsp;&nbsp;验证码: </label>
<div class= "x-form-element " style= "padding-left: 60px "> <input type= "text " name= "yzm " id= "yzm " runat= "server " /> <span class= "info "> 请输入下图所示的字母或数字, <a title= "看不清验证码?点击可更换 " href= "javascript:newverifypic(); "> 看不清楚? </a> </span> < /div>
</div>


<asp:Image ID= "verifypic " runat= "server " Height= "30px " ImageUrl= "~\ValidateCode.aspx " Width= "75px " style= "padding:0 0 0 65px; " />