ecshop ajax无刷新登陆

前端之家收集整理的这篇文章主要介绍了ecshop ajax无刷新登陆前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<!--{if $user_info}-->


<div class="lef_tit_bj">会员登陆</div>

<div class="left_conn_bj">

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="50" align="center" valign="middle"><label><strong>Hello {$user_info.username}</strong></label></td>

</tr>

<tr>

<td height="30" align="center" valign="middle"><strong>欢迎光临本店</strong></td>

</tr>

<tr>

<td height="40" align="center" valign="bottom"><label>

<a href="user.PHP?act=logout"> <img src="../images/tuichu.gif"></a>

&nbsp;

<a href="user.PHP"> <img src="../images/jinrultan.gif"></a>

</label></td>

</tr>

</table>

</div>

</div>


<!--{else}-->



<div class="lef_tit_bj">会员登录</div>

<div class="left_conn_bj">

<form id="ECS_LOGINFORM" name="ECS_LOGINFORM" method="post" action="javascript:signIn()">

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="50" align="right" valign="middle">用户名:</td>

<td height="50" align="left" valign="middle"><label>

<input type="text" name="username" class="yonhu_input" style="height:15px;"/>

</label></td>

</tr>

<tr>

<td height="30" align="right" valign="middle"> 密&nbsp; 码:</td>

<td height="30" align="left" valign="middle"><input type="password" name="password" class="yonhu_input" style="height:15px;" /></td>

</tr>

<tr>

<td height="40" colspan="2" align="center" valign="bottom"><label>

<input type="image" name="imageField" src="images/denglu_bann.jpg" />

&nbsp;

<a href="user.PHP?act=register"><img src="images/zhuce_bann.jpg" border="0" /></a>

</label></td>

</tr>

</table>

</form>

</div>

</div>

<!--{/if}-->

{literal}

<script type="text/javascript">

function signIn()

{

var frm = document.forms['ECS_LOGINFORM'];


if (frm)

{

var username = frm.elements['username'].value;

var password = frm.elements['password'].value;

var captcha = '';

if (frm.elements['captcha'])

{

captcha = frm.elements['captcha'].value;

}


if (username.length == 0 || password.length == 0)

{

{/literal}

alert("{$lang.empty_username_password}");

{literal}

return;

}

else

{

Ajax.call('user.PHP?act=signin','username=' + username + '&password=' + encodeURIComponent(password) + '&captcha=' + captcha,signinResponse,"POST","TEXT");

}

}

else

{

alert('Template error!');

}

}


function signinResponse(result)

{

var userName = document.forms['ECS_LOGINFORM'].elements['username'].value;

var mzone = document.getElementByIdx_x("ECS_MEMBERZONE");

var res = result.parseJSON();


if (res.error > 0)

{

alert(res.content);

if(res.html)

{

mzone.innerHTML = res.html;

document.forms['ECS_LOGINFORM'].elements['username'].value = userName;

}

}

else

{

if (mzone)

{

mzone.innerHTML = res.content;

evalscript(res.ucdata);

//alert(res.ucdata);

}

else

{

window.location.reload()

}

}

}

</script>


{/literal}

猜你在找的Ajax相关文章