var codeok = false;
var loading;
function artmsg(content)
{
art.dialog({
title:'提示',
content: content
});
}
function artmsgok(content)
{
art.dialog({
icon: 'succeed',
title:'提示',
content: content
});
}
function checkdialogcode(formid) {
$(formid).find("input:text,textarea").each(function(index, element) {
if ($(this).attr("tip") == $(this).val()) {
$(this).val("");
}
});
if ($(formid).valid()) {
art.dialog({
title: '请输入验证码',
content: ' ',
lock: true,
style: 'succeed noclose',
ok: function() {
var d = new date();
$.get('checkcode.asp?vcode=' + $("#vcode").val() + "&t=" + d.totimestring(),
function(data) {
if (data == "√") {
$(formid).submit();
closedialog();
} else {
$("#vmsg").html("" + data + "");
return false;
}
})
return false;
},
okval: 'submit',
cancelval: 'cancel',
cancel: true,
width: 300
})
reloadvcode("#imgcode")
}
}
function closedialog()
{
var list = art.dialog.list;
for (var i in list) {
list[i].close();
};
}
function setajaxform(form, fun) {
var d = new date();
var ajaxform=$(form)
mytextmark(ajaxform)
ajaxform.ajaxform({
beforesubmit:function(a,form,options){
if(form.valid())
{
return true;
}
else
{
return false;
}
},
success: function(data) {
fun(data)
}
});
}
function reloadvcode(obj,tipid)
{
var d = new date();
$("#vcode").val("")
$(tipid).html("")
$(obj).attr("src","dv_getcode.asp?t="+d.totimestring());
}
function checkcode(obj,form,tipid)
{
var me=$(obj)
var myform=$(form)
var tip=$(tipid);
if(me.val().length<4)
{
tip.empty();
}
else
{
var d = new date();
$.get("checkcode.asp?vcode="+me.val()+"&t="+d.totimestring(),function(data){
if(data=="√")
{
tip.html(""+data+"")
}
else{
tip.html(""+data+"")
}
});
}
}
function mytextmark(form) {
form.find("input:text,textarea").each(function(index, element) {
if ($(this).attr("tip") != "") {
$(this).focus(function() {
if ($(this).val() == $(this).attr("tip")) {
$(this).val("")
}
})
$(this).blur(function() {
if ($(this).val() == "") {
$(this).val($(this).attr("tip"))
}
})
}
});
}