- layui.use(['layer','form','upload'], function(){
- var layer = layui.layer , form = layui.form , upload = layui.upload; //获取upload模块
- });
- $(document).ready(function(){
- var urldz;
- $("#downurl").click( function () {
- if($(this).attr("urldz"))
- {
- window.location.href=$(this).attr("urldz");
- }
- });
- //var arr=["zip","gz","rar","iso","doc","xsl","ppt","wps","swf","mpg","mp3","rm","rmvb","wmv","wma","wav","mid","mov"];
- var arr=[".zip",".gz",".rar",".iso",".doc",".xsl",".ppt",".wps",".swf",".mpg",".mp3",".rm",".rmvb",".wmv",".wma",".wav",".mid",".mov",".docx",".pdf",".mp4"];
- $(".downcon a").click(function() {
- url = $(this).attr("href");
- var hfind = false;
- for ( var i = 0; i <arr.length; i++){
- if(url.indexOf(arr[i])!=-1)
- {
- hfind =true;
- break;
- }
- }
- if(hfind)
- {
- //$("#downformcon").show();
- layer.open({
- type: 1,
- title: '请填写信息,提交成功即可下载!',
- area: ['800px', '600px'],
- shadeClose: false, //点击遮罩关闭
- content: $('#downformcon')
- });
- //tjform(form1,url);
- $("#downurl").attr("urldz",url);
- return false;
- }
- })
- });
- //onclick="send()"
- $("#tjform").submit(function()
- {
- //$(".downurl").show();
- //window.location.href=url;
- //window.open("http://www.it2168.com");
- if(tjform(this))
- {
- //var dataString = 'iname='+ $("#name").val() + '&email=' + $("#email").val() + '&tel=' + $("#tel").val()+ '&website=' + $("#website").val()+ '&action=post'+ '&diyid=1&do=2&dede_fields=iname,text;email,text;tel,text;website,text;content,text&dede_fieldshash=1f6d061a5dd65989abfd887';
- $.ajax({
- type: "POST",
- url: "/user/plus/diy.php",
- //data: dataString,
- data:$('#tjform').serialize(),// 你的form id
- success: function(url){
- //$("#tjformtips").show();
- $(".downurl").show();
- window.location.href=url;
- }
- })
- return false;
- }
- else
- {
- return false;
- }
- })
- function tjform(form1){
- if(form1.chenghu.value==""){
- alert("请输入你的姓名!");
- form1.chenghu.focus();
- return false;
- }
- if(form1.tel.value==""){
- alert("请输入你的电话!");
- form1.tel.focus();
- return false;
- }
- if(!(/^1[34578]\d{9}$/.test(form1.tel.value))){
- alert("手机号码有误,请重填");
- form1.tel.focus();
- return false;
- }
- if(form1.v_email.value==""){
- alert("请输入你的邮箱!");
- form1.v_email.focus();
- return false;
- }
- if(!is_email(form1.v_email.value))
- {
- alert("邮箱格式错误!");
- form1.v_email.focus();
- return false;
- }
- if(form1.company.value==""){
- alert("请输入你的公司!");
- form1.company.focus();
- return false;
- }
- return true;
- }
复制代码
|