<div class="pagein-message">
<div class="message-tit">預(yù)約留言</div>
<form id="objForm" action="{$action}">
<div class="message-main clr">
<div class="message-main-left">
<div class="tr">
<div class="tr-tip">姓名</div>
<input type="text" class="textinput" name="username" id="username" placeholder="請(qǐng)輸入姓名" />
</div>
<div class="tr">
<div class="tr-tip">手機(jī)</div>
<input type="text" class="textinput" name="phone" id="phone" placeholder="請(qǐng)輸入手機(jī)號(hào)碼" />
</div>
<div class="tr">
<div class="tr-tip">地址</div>
<input type="text" class="textinput" name="address" id="address" placeholder="請(qǐng)輸入地址" />
</div>
</div>
<div class="message-main-right">
<div class="tr">
<div class="tr-tip">內(nèi)容</div>
<textarea class="textarea" name="content" id="remarks" placeholder="請(qǐng)正確輸入留言內(nèi)容,不超過200字!"></textarea>
</div>
</div>
</div>
<input type="button" class="submitbtn" id="submitBtn" value="提交留言">
</form>
</div>
<style type="text/css">
#Validform_msg{color:#7d8289; font: 12px/1.5 tahoma, arial, 5b8b4f53, sans-serif; width:280px;
-webkit-box-shadow:0px 0px 3px #aaa; -moz-box-shadow:0px 0px 3px #aaa;
background:#fff; position:absolute; top:0px; right:50px; z-index:99999; display:none;
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=135, Color='#999999');
-moz-box-shadow: 0 0 20px #000;
-webkit-box-shadow: 0 0 20px #000;
box-shadow: 0 0 20px #000;}
#Validform_msg .iframe{position:absolute; left:0px; top:-1px; z-index:-1;}
#Validform_msg .Validform_title{line-height:40px; height:40px; text-align:left; font-weight:bold; padding:0 20px; color:#333; position:relative; background-color:#ddd;}
#Validform_msg a.Validform_close:link,#Validform_msg a.Validform_close:visited{line-height:40px;
position:absolute; right:20px; top:0px; color:#333; text-decoration:none;font-size: 12px;}
#Validform_msg a.Validform_close:hover{color:#666;}
#Validform_msg .Validform_info{padding:20px;border-top:none; text-align:left;}
</style>
/*
@name: 內(nèi)頁留言
*/
.pagein-message{
height:515px;overflow: hidden;background: url("@{img-url}message-bg.jpg") no-repeat center top;
/* @{img-url}指向路徑@img-url: "../../images/" */
&-tit{font-size: 26px;margin: 51px 0 42px 0;text-align: center;color: #fff;line-height: 30px;}
&-main{
width: 1200px;margin:0 auto;
&-left{float: left;}
&-right{float: right;}
}
.tr{
width: 588px;
&-tip{font-size: 18px;color: #fff;line-height: 50px;padding-left: 70px;position: relative;
&:after{content:'';width:4px;height:4px;display:block;position: absolute;top: 50%;left: 50px;background: #f00;margin:-2px 0 0 -2px;.border-radius(5px);}
}
.textinput{width: 570px;height: 34px;line-height: 34px;display: block;border:0;padding-left: 18px;.border-radius(5px);}
.textarea{width: 568px;display: block;border: 0;padding:0 10px;height: 202px;font-family: "Microsoft YaHei";line-height: 30px;}
}
.submitbtn{width: 180px;height:38px;font-size: 18px;color: #fff;margin: 48px auto 30px auto;border:0;display: block;background: #ff4343;.border-radius(5px);}
}
var default = {
/*
* 表單提交
*/
formSub : function(){
var formvalid = $('#objForm').Validform({
btnSubmit:"#submitBtn",
beforeSubmit : function(curform) {
default.submitForm();
return false;
}
});
formvalid.addRule([
{
ele:"#username",
datatype:/^[\u4E00-\u9FA5\uf900-\ufa2d]{2,6}$/,
nullmsg:"請(qǐng)輸入中文姓名!",
errormsg:"請(qǐng)正確輸入中文姓名!"
},
{
ele:"#phone",
datatype:/^(0|86|17951)?(13[0-9]|15[012356789]|17[01678]|18[0-9]|14[57])[0-9]{8}$/,
nullmsg:"請(qǐng)輸入電話號(hào)碼!",
errormsg:"請(qǐng)正確填寫手機(jī)號(hào)格式、如:13511111111"
},
{
ele:"#address",
datatype:"*1-50",
nullmsg:"請(qǐng)輸入地址!",
nullmsg:"請(qǐng)正確輸入地址,不超過50字!"
},
{
ele:"#remarks",
datatype:"*1-200",
nullmsg:"請(qǐng)輸入留言內(nèi)容!",
nullmsg:"請(qǐng)正確輸入留言內(nèi)容,不超過200字!"
}
]);
},
submitForm : function(){
$.ajax({
type : 'POST',
url : $('#objForm').attr('action'),
data : $('#objForm').serialize(),
dataType : 'json',
success : function(data){
if(data.status){
layer.alert(data.message, {
icon: 6,
yes: function(index){
location.reload();
}
});
}else{
layer.alert(data.message, {icon: 5});
}
}
});
}
}