66 lines
2.5 KiB
HTML
66 lines
2.5 KiB
HTML
{template "header.html"}
|
|
|
|
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
|
|
{dr_form_hidden()}
|
|
<div class="form-body" style="margin-top: -10px">
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-2 control-label">{dr_lang('测试文字')}</label>
|
|
<div class="col-md-9">
|
|
<textarea name="data[text]" class="form-control" style="height:100px; width:100%;"></textarea>
|
|
<p class="help-block"> {dr_lang('填写需要测试验证的文字')} </p>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-md-2 control-label">{dr_lang('正则表达式')}</label>
|
|
<div class="col-md-9">
|
|
<textarea name="data[code]" id="dr_code" class="form-control" style="height:100px; width:100%;"></textarea>
|
|
<p class="help-block"> {dr_lang('填写PHP格式的正则表达式代码,匹配函数preg_match')} </p>
|
|
<label><select class="form-control" onchange="dr_add_code(this.value)">
|
|
<option value="">{dr_lang('常用正则表达式')}</option>
|
|
{loop $code $name $cc}
|
|
<option value="{$cc}">{dr_lang($name)}</option>
|
|
{/loop}
|
|
</select></label>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="portlet-body form myfooter">
|
|
<div class="form-actions text-center">
|
|
<button type="button" onclick="dr_test_pattern()" class="btn green"> <i class="fa fa-send"></i> {dr_lang('立即测试')}</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
function dr_add_code(v) {
|
|
$('#dr_code').val(v);
|
|
}
|
|
function dr_test_pattern() {
|
|
var loading = layer.load(2, {
|
|
shade: [0.3,'#fff'], //0.1透明度的白色背景
|
|
time: 100000000
|
|
});
|
|
$.ajax({
|
|
type: "POST",
|
|
dataType: "json",
|
|
url: "{dr_now_url()}",
|
|
data: $("#myform").serialize(),
|
|
success: function(json) {
|
|
layer.close(loading);
|
|
if (json.code) {
|
|
dr_cmf_tips(1, json.msg, json.data.time);
|
|
} else {
|
|
dr_cmf_tips(0, json.msg, json.data.time);
|
|
}
|
|
},
|
|
error: function(HttpRequest, ajaxOptions, thrownError) {
|
|
dr_ajax_alert_error(HttpRequest, this, thrownError);
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
{template "footer.html"} |