// JavaScript Document $(document).ready(function() { new WOW().init(); const isDesktop = window.innerWidth >= 960 if (isDesktop) { // 桌面端操作 } else { // 手机端操作 $(".nav-list li .nav-list-sub a").click( function() { //console.log(111); $(".nav-list li .nav-list-sub .nav-list-height").addClass('none'); }); // 获取元素 var pagumb = document.querySelector('.current'); //var pagumb = document.getElementById(".current"); // // 判断元素值是否为1 // if (pagumb.innerHTML === "1") { // // 添加样式 // $(".current").addClass("pag01"); // 示例:将颜色设置为红色 // $("div.pages a:nth-child(1)").addClass("pagnone"); // } if (pagumb !== null) { if (pagumb.innerHTML === "1") { $(".current").addClass("pag01"); $("div.pages a:nth-child(1)").addClass("pagnone"); } } else { // 处理元素未找到的情况 } } /* 点击展示产品更多简介 */ $(".pro-des span").click( function () { $(this).addClass("off"); $(this).parents(".pro-des").addClass("jsmore"); }); // 鼠标经过语言 $('.lang-box').hover(function(){ if(!phoneIs()){ animOn('.lang-box dd'); } },function(){ if(!phoneIs()){ animOff('.lang-box dd'); } }); //const p = document.querySelector(".pro-des p"); // const btn = document.querySelector(".pro-des span"); // if (p.offsetHeight > p.clientHeight) { // btn.classList.add("active"); // } // btn.addEventListener("click", () => { // p.style.webkitLineClamp = "unset"; // //btn.classList.remove("active"); // btn.classList.add("none"); // }); // const paragraphs = Array.from(document.querySelectorAll(".pro-des p")); // const btn = document.querySelector(".pro-des span"); // paragraphs.forEach((p) => { // if (p.offsetHeight > p.clientHeight) { // p.classList.add("active"); // btn.classList.add("active"); // } // }); // btn.addEventListener("click", () => { // paragraphs.forEach((p) => { // p.style.webkitLineClamp = "unset"; // //p.classList.remove("active"); // btn.classList.add("none"); // }); // btn.classList.remove("active"); // }); // const paragraphs = Array.from(document.querySelectorAll(".pro-des p")); // const buttons = document.querySelectorAll(".pro-des span"); // buttons.forEach((btn) => { // const target = btn.dataset.target; // const paragraph = document.querySelector(target); // if (paragraph.offsetHeight > paragraph.clientHeight) { // paragraph.classList.add("active"); // btn.classList.add("active"); // } // btn.addEventListener("click", () => { // paragraph.style.webkitLineClamp = "unset"; // paragraph.classList.remove("active"); // btn.classList.remove("active"); // btn.classList.add("none"); // }); // }); //导航 new nav('.nav','.nav-btn') layui.use('layer', function(){ var layer = layui.layer; //相册弹层 layer.photos({ photos: '#layer-photos' ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) ,shade: .85 }); var vid = 0; $('.video-btn').each(function(index,el){ $(this).attr('data-num',index); }) $('.video-btn').click(function(e){ vid = $(this).attr('data-num'); var flag = false; var type = ["mp4"]; var tit = $(this).attr('data-title')?$(this).attr('data-title'):''; var index = $(this).attr('data-video').lastIndexOf("."); var ext = $(this).attr('data-video').substr(index+1); //循环比较 for(var i=0;i当前浏览器不支持 video直接播放', }); var video = document.getElementById("video"); video.play(); }else{ layer.open({ type: 2, title: false, shade: 0.7, anim: 5, isOutAnim:false, skin:'video-show', content: $(this).attr('data-video'), }); } //创建按钮名称 $('.video-show .layui-layer-content').append('
'+tit+'
'); vidBtn('.video-prev','.video-next',vid,0,$('.video-btn').length); }); //视频切换 $('body').on('click','.video-switch-btn',function(){ if($(this).hasClass('video-prev')){ vid--; }else if($(this).hasClass('video-next')){ vid++; } $(this).parent().find('video').attr('src',$("[data-num='"+vid+"']").attr('data-video')); $(this).parent().find('.video-tit span').html($("[data-num='"+vid+"']").attr('data-title')?$("[data-num='"+vid+"']").attr('data-title'):''); var video = document.getElementById("video"); video.play(); vidBtn('.video-prev','.video-next',vid,0,$('.video-btn').length); }) }); //鼠标经过动画 $('.e-anim').hover(function(){ $(this).addClass('anim-on').removeClass('anim-off'); },function(){ $(this).addClass('anim-off').removeClass('anim-on'); }); // 鼠标经过搜索 // $('.search-box').hover(function(){ // if(!phoneIs()){ // animOn('.search-inp'); // } // }); $('.nav-list li').hover(function(){ if(!phoneIs() && $('.search-inp').hasClass('e-anim-on')){ animOff('.search-inp'); } }); $('body').click(function(){ if(!phoneIs() && $('.search-inp').hasClass('e-anim-on')){ animOff('.search-inp'); } }); //返回顶部 $('.top-btn').click(function(){ $('html,body').animate({scrollTop:0}, document.body.scrollHeight/10); }) //放大镜 $('.small').mousemove(function(e){ // console.log('鼠标移进',$('.zfx')) $('.zfx').show(); //1.获取鼠标相对于small这个区域的坐标点,并减去zfx的width的一半才能使鼠标一直在zfx中间的位置 let x = e.pageX - $(this).offset().left; let y = e.pageY - $(this).offset().top; x= x- $('.zfx').outerWidth()/2; y =y-$('.zfx').outerHeight()/2 // 水平方向最大值 let maxX = $(this).innerWidth() - $('.zfx').innerWidth(); //垂直向最大值 let maxY = $(this).innerHeight() -$('.zfx').innerHeight(); if(x<0){ //相当于超出左侧,超出左侧时,拉回 x=0; } //zfx超出右侧时拉回 if(x>maxX){ x = maxX; } //顶部超出 if(y<0){ y=0; } //底部超出 if(y>maxY){ y = maxY; } $('.zfx').css({'transform':`translate(${x}px,${y}px)`}) //2.计算放大比例 let a = $('.e-anim-on .big>img').innerWidth()-$('.big').innerWidth(); let b = $('.e-anim-on .big>img').innerHeight()-$('.big').innerHeight(); let bigScrollx = x/maxX*a; let bigScrolly = y/maxY*b ; // console.log($(this).parents(".mess").find('.big').attr("class")); // $(this).parents(".mess").find('.big'); $('.e-anim-on .big').scrollLeft(bigScrollx).scrollTop(bigScrolly).css({'display':'inline-block'}); //console.log(bigScrollx,bigScrolly); }) $('.small').mouseleave(function(){ // console.log('鼠标移出') $('.big').css({'display':'none'}); $('.zfx').hide(); }) /* 产品页栏目 */ // 点击一级菜单展开/收起二级菜单 $('.topmenu > a').click(function() { // 获取当前一级菜单 var thisTopmenu = $(this).parent(); // 判断当前一级菜单是否是激活状态 if (thisTopmenu.hasClass('active')) { // 如果是激活状态,则收起当前一级菜单下面的二级菜单 thisTopmenu.find('.submenu').slideUp(200, function() { thisTopmenu.removeClass('active'); }); } else { // 如果不是激活状态,则先收起其他一级菜单下面的二级菜单,再展开当前一级菜单下面的二级菜单 $('.topmenu.active').removeClass('active').find('.submenu').slideUp(200); thisTopmenu.addClass('active').find('.submenu').slideDown(200); } return false; }); }); var tht; $(window).scroll(function(e) { }); var sizeTimer = null; $(window).resize(function() { clearTimeout(sizeTimer); sizeTimer = setTimeout(function(){ },400); }); //网站类型 function phoneIs() { if($('.nav-box .container').outerWidth()<960){ return true }else{ return false; } } //获取左偏移值 // function navl(obj){ // if(!phoneIs()){ // $(obj).find('.nav-list-sub').removeAttr('style'); // var pl = 0; // parentLeft(obj); // var lmax = pl + $(obj).find('.nav-list-height').outerWidth()-$('.container-header').position().left; // //判断左偏移加宽度是否超出 // if(lmax > $('.nav-box .container').width()){ // var l = $('.nav-box .container').width() - lmax; // $(obj).find('.nav-list-sub').css('width',$(obj).find('.nav-list-height').outerWidth()+1); // $(obj).find('.nav-list-sub').css('left',l+20); // }else{ // $(obj).find('.nav-list-sub').css('width',$(obj).find('.nav-list-height').outerWidth()+1); // } // console.log($('.nav-box .container').width(),lmax); // }else{ // $('.nav-list-sub').css('width',''); // } // //递归到body // function parentLeft(obj){ // if(!$(obj).is('body')){ // parentLeft($(obj).parent()) // } // pl += $(obj).position().left; // } // } //swiper2.x,auto显示数量 function swiperSL(cla,obj,ss,mm,ll){ swiperDX(cla,obj,ss,mm,ll); $(window).resize(function() { swiperDX(cla,obj,ss,mm,ll); }); } function swiperDX(c,o,s,m,l){ var w = $('.container').outerWidth(); var x = $(c).outerWidth(); if(w>=960){ $(c).find('.swiper-slide').css('width',x/l); }else if(w>=720){ $(c).find('.swiper-slide').css('width',x/m); }else{ $(c).find('.swiper-slide').css('width',x/s); } o.resizeFix(); } //设备横竖屏判断 /* window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() { //竖屏 if (window.orientation === 180 || window.orientation === 0) { $('html').removeClass('landscape'); } //横屏时提示 if (window.orientation === 90 || window.orientation === -90 ){ $('html').addClass('landscape'); } }, false); */ //进入全屏 function enterFullScreen() { var de = document.documentElement; if (de.requestFullscreen) { de.requestFullscreen(); } else if (de.mozRequestFullScreen) { de.mozRequestFullScreen(); } else if (de.webkitRequestFullScreen) { de.webkitRequestFullScreen(); } } //退出全屏 function exitFullScreen() { var de = document; if (de.exitFullscreen) { de.exitFullscreen(); } else if (de.mozCancelFullScreen) { de.mozCancelFullScreen(); } else if (de.webkitCancelFullScreen) { de.webkitCancelFullScreen(); } } //判断是否全屏 $(window).resize(function() { var fullscreenElement = document.fullscreenEnabled || document.mozFullscreenElement || document.webkitFullscreenElement; var fullscreenEnabled = document.fullscreenEnabled || document.mozFullscreenEnabled || document.webkitFullscreenEnabled; if (fullscreenElement == null) { //非全屏 $('.icon-fullscreen').show(); $('.icon-fullexit').hide(); } else { //全屏 $('.icon-fullscreen').hide(); $('.icon-fullexit').show(); } }); //视频背景居中 function bgVideo(id,opt){ var bgVideo = document.getElementById(id); var vidH = opt.height?opt.height:document.body.offsetWidth; var videoWH,videoVW,videoVH,videoTime; //视频初始化 bgVideo.onresize = function(){ videoSize(); } document.read = function(){ clearTimeout(videoTime) videoTime = setTimeout(function(){videoSize()},50); } addEventOnLoad(function(){ clearTimeout(videoTime) videoTime = setTimeout(function(){videoSize()},50); }) addEventOnResize(function(){ clearTimeout(videoTime) videoTime = setTimeout(function(){videoSize()},50); }) //视频背景缩放计算 function videoSize(){ videoVW = bgVideo.videoWidth; videoVH = bgVideo.videoHeight; videoWH =videoVW/videoVH; var windowW = document.documentElement.clientWidth; var windowH = vidH; //宽高比例比较 if( windowW / windowH > videoWH ){ // bgVideo.classList.add('video-bg-w'); // bgVideo.classList.remove('video-bg-h'); bgVideo.style.width = windowW+'px'; bgVideo.style.height = windowW/videoWH+'px'; }else{ // bgVideo.classList.add('video-bg-h'); // bgVideo.classList.remove('video-bg-w'); bgVideo.style.height = windowH+'px'; bgVideo.style.width = windowH*videoWH+'px'; } } } //当前日期 function presentTime(){ var show_day=new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六'); var time=new Date(); var year=time.getFullYear(); var month=time.getMonth(); var date=time.getDate(); var day=time.getDay(); var hh=time.getHours(); var mm=time.getMinutes(); var ss=time.getSeconds(); month=month+1; month<10?month='0'+month:month; date<10?date='0'+date:date; hh<10?hh='0'+hh:hh; mm<10?mm='0'+mm:hh; ss<10?ss='0'+ss:hh; var now_time=''+year+'年'+month+'月'+date+'日'+' '+show_day[day]+''; $('#present-time').html(now_time); } setInterval(presentTime,100); //tabs切换 function tabs(cla,opt){ var obj = this; var oh,nh;//切换前后的高度 //切换的样式名 var hd = ".hd"; var bd = ".bd"; //opt接受的参数 var clickEvent = true;//是否接受点击事件 var mouseenterEvent = true;//是否接受鼠标经过事件 var fun;//切换后的回调,function(index){},返回切换后的INDEX值 //获取定义值 if(opt){ clickEvent = opt.clickEvent != null?opt.clickEvent:clickEvent; mouseenterEvent = opt.mouseenterEvent != null?opt.mouseenterEvent:mouseenterEvent; fun = opt.fun?opt.fun:''; hd = opt.hd != null?opt.hd:hd; bd = opt.bd != null?opt.bd:bd; } var event =''; clickEvent?event +=' click':''; mouseenterEvent?event +=' mouseenter':''; //鼠标触发切换事件 $(cla).find(hd).children().on(event,function(e){ //手机版阻止切换按钮的链接跳转 if(phoneIs()){ stopDefault(e); } if(!$(this).hasClass('on')){ //获取切换后的INDEX var index = $(this).index(); obj.tabsSwitch(index,true); } }) //tabs方法 //切换方法 obj.tabsSwitch = function(i,setHeight){ //获取切换前高度 oh = $(cla).find(bd).children('.e-anim-on').outerHeight(); //$(cla).find(bd).css({'height':oh}); $(cla).find(hd).children().eq(i).addClass('on').siblings().removeClass('on'); $(cla).find(bd).children('.e-anim-on').removeClass('e-anim-on').addClass('e-anim-off'); $(cla).find(bd).children().eq(i).removeClass('e-anim-off').addClass('e-anim-on'); if(setHeight){ //获取切换后高度 nh = $(cla).find(bd).children('.e-anim-on').outerHeight(); //$(cla).find(bd).css({'height':nh}); $(cla).find(bd).children('.e-anim-off').each(function(){ var el = this; animOff(el,{'fun':function(){ $(el).parents(bd).css({'height':''}); }}) }); } //切换后回调 fun?fun(i):''; } //初始化 $(cla).find(bd).children().addClass('e-anim-hide'); obj.tabsSwitch(0,false); } //导航 function nav(cla,btn,opt){ //opt接受的参数 //移动端导航事件 $(btn).click(function(event){ propagation(); //回到顶部 //$('html,body').animate({scrollTop:0},100); $(btn).toggleClass('nav-btn-show'); if(!$(btn).hasClass('nav-btn-show')){ closeNav() } animSwitch(cla); }); //手机版带二级阻止跳转 $(cla).find('li>a').click(function(e){ if(phoneIs() && $(this).next('.nav-list-sub').length>0){ stopDefault(e); } }) //手机点击导航 $('.nav li .nav-yjlanmu').click(function(){ if(phoneIs()){ $('.nav-list-sub').css('height',0); $('.nav-list-sub .e-anim-on').each(function(){ //animOff(this); }); if($(this).next('.nav-list-sub').length){ $(this).parent().toggleClass('nav-on').siblings().removeClass('nav-on'); } if($(this).parent().hasClass('nav-on')){ console.log(1212121); animOn($(this).parent().find('.e-anim-hide')); }else{ animOff($(this).parent().find('.e-anim-hide')); } //获取高度 var navSubH = $(this).hasClass('nav-on') ? $('.nav-list').find('.nav-list-height').outerHeight() : 0; $(this).find('.nav-list-sub').css('height',navSubH); } }); //导航拦截冒泡 $('.nav-box').click(function(){ propagation(); }); //防IE抖动 $('.nav-list li .on .nav-btn-bg').css({'width':$('.nav-list .on').parent().outerWidth()}) //PC导航鼠标经过 $(cla).find('.nav-list li').mouseenter(function(){ if(!phoneIs()){ $(cla).find('li').removeClass('nav-on'); $(this).addClass('nav-on').siblings().addClass('nav-off'); if($(this).find('.nav-list-sub').length>0){ animOn($(this).find('.e-anim-hide')); } //导航滑块 if($('.nav-list li .on').length >= 1){ $('.nav-list li .on .nav-btn-bg').css({'left':$(this).offset().left-$('.nav-list .on').offset().left,'width':$(this).width()})//个别特殊网站可加入误差修正 }else{ $('.nav-btn-bg-02').addClass('nav-btn-bg-02-show').css({'left':$(this).offset().left-$('.nav-list').offset().left-1,'width':$(this).width()}) } if($(this).find('.nav-list-height').length>0){ //二级下拉背景色 $('.nav-list-sub-bg').addClass('e-animte-show nav-list-sub-bg-show'); } //下拉偏移 //navl(this); //二级选中 if($(this).find('.nav-list-sub .on').length){ var subOn = $(this).find('.nav-list-sub .on'); $(this).find('.nav-list-sub .btn-sub-bg').css({'left':subOn.find('span').offset().left-subOn.parent().offset().left,'width':subOn.find('span').width(),'transition-duration':'0s'}) } } }); //PC导航鼠标离开 $(cla).find('.nav-list li').mouseleave(function(){ if(!phoneIs()){ $(this).removeClass('nav-on').siblings().removeClass('nav-off'); $('.nav-list li .on .nav-btn-bg').removeAttr('style'); $('.nav-list li .on .nav-btn-bg').css({'width':$('.nav-list .on').parent().outerWidth()}) if($(this).find('.e-anim-hide').length){ var el = $(this).find('.e-anim-hide'); animOff(el,{fun:function(){ el.parent().css({'width':''}) }}); } //二级下拉背景色 $('.nav-list-sub-bg').removeClass('e-animte-show nav-list-sub-bg-show'); } $(this).find('.btn-sub-bg').css({'width':'','left':''}) }); //PC导航鼠标二级 $(cla).find('.nav-list-sub a').mouseenter(function(){ $(this).parent().find('.btn-sub-bg').css({'left':$(this).find('span').offset().left-$(this).parent().offset().left,'width':$(this).find('span').width(),'transition-duration':''}) }); $('.nav-list').mouseleave(function(){ $('.nav-btn-bg-02').removeClass('nav-btn-bg-02-show').removeAttr('style'); }) } //收起导航 function closeNav(){ $('.nav-list-sub').css('height',0); $('.nav-list li').removeClass('nav-on'); $('.nav .e-anim-on').each(function(){ animOff(this); }) } //切换动画 function animSwitch(obj,onOpt,offOpt){ var el; if($(obj).hasClass('e-anim-hide')){ el = $(obj); }else{ el = $(obj).children('.e-anim-hide'); } if(!el.hasClass('e-anim-on')){ animOn(obj,onOpt) }else{ animOff(obj,offOpt) } } //添加动画 function animOn(obj,opt){ var fun; if(opt){ fun = opt.fun?opt.fun:''; } var el; if($(obj).hasClass('e-anim-hide')){ el = $(obj); }else{ el = $(obj).children('.e-anim-hide'); } el.addClass('e-anim-on').removeClass('e-anim-off'); var foo = function(){ //回调 if(el.hasClass('e-anim-on')){ fun?fun(obj):''; } el[0].removeEventListener('animationend',foo,false); } el[0].addEventListener('animationend', foo,false); } //移除动画 function animOff(obj,opt){ var fun; var removeOff = true;//动画结束后是否移除 e-anim-off if(opt){ fun = opt.fun?opt.fun:''; removeOff = opt.removeOff?opt.removeOff:true; } var el; if($(obj).hasClass('e-anim-hide')){ el = $(obj); }else{ el = $(obj).children('.e-anim-hide'); } el.addClass('e-anim-off').removeClass('e-anim-on'); var foo = function(){ //回调 if(el.hasClass('e-anim-off')){ fun?fun(obj):''; } removeOff?el.removeClass('e-anim-off'):''; el[0].removeEventListener('animationend',foo,false); } el[0].addEventListener('animationend', foo,false); } //字符截取 function subStr(str,length){ var a=str.match(/[^\x00-\xff]|\w{1,2}/g); return a.length$('.nav-box').outerHeight()+$('.banner-min').outerHeight()+$('.banner-box').outerHeight()+$('.ind-box').outerHeight()+$('.footer-bg').outerHeight()){ $('.ind-box').css('min-height',$(window).height()-$('.nav-box').outerHeight()-$('.banner-min').outerHeight()-$('.banner-box').outerHeight()-$('.footer-bg').outerHeight()); } } //视频翻页 function vidBtn(prev,next,num,min,max){ $(prev).show(); $(next).show(); if(num == min){ $(prev).hide(); } if(num == max-1){ $(next).hide(); } } //阻止冒泡事件 function propagation(){ if (event.stopPropagation) { // this code is for Mozilla and Opera event.stopPropagation(); } else if (window.event) { // this code is for IE window.event.cancelBubble = true; } } //阻止跳转 function stopDefault(e) { if ( e && e.preventDefault ) e.preventDefault(); else window.event.returnValue = false; return false; } //数字增加动效 function increase(cla,opt){ //opt接受的参数 var time = 1500;//动画时长 var obl = false;//是否结合其他回调,重复动画 var dec = false;//是否分节号 //获取定义值 if(opt){ time = opt.time != null?opt.time:time; obl = opt.obl != null?opt.obl:obl; dec = opt.dec != null?opt.dec:dec; } $(window).scroll(function(e) { if(!obl){ numEach(cla); } }) $(function() { if(!obl){ numEach(cla); } }) if(obl){ $(cla).each(function(index){ numAnimate(this); }) } //遍历内容 function numEach(obj){ $(obj).each(function(index){ var t = $(this).offset().top; var st = $(document).scrollTop(); var h = $(window).height(); if(t>st && t1){ le = fl[1].length; } $(obj).text(dec?thousands(now.toFixed(le)):now.toFixed(le)); } }); } } // 数字添加分节号 function thousands(num){ var str = num.toString(); var reg = str.indexOf(".") > -1 ? /(\d)(?=(\d{3})+\.)/g : /(\d)(?=(?:\d{3})+$)/g; return str.replace(reg,"$1,"); } //自动滚动列表 function rollList(cla,opt){ var offset = opt.offset ? opt.offset : 0;//误差修正 var direction = opt.direction ? opt.direction : 'top'; var hover = opt.hover !== '' ? opt.hover : true; var speed = opt.speed ? opt.speed : 0.5; var sNum = 0; var hoverIs = true; var that = $(cla).children(); $(that).wrapAll('
'); $(cla).find('.list-scroll').css({'position':'absolute','left':'0','top':'0'}); $(that).after($(cla).find('.list-scroll').html()); $(that).after($(cla).find('.list-scroll').html()); $(cla).find('.list-wrap').mouseenter(function(){ if(hover){ hoverIs = false; //cancelAnimationFrame(listGo); } }) $(cla).find('.list-wrap').mouseleave(function(){ if(hover){ hoverIs = true; requestAnimationFrame(listGo); } }) requestAnimationFrame(listGo); function listGo() { var listH = $(that).outerHeight(); var listW = $(that).outerWidth(); $(cla).find('.list-wrap').css({'height':listH+offset,'overflow':'hidden','position':'relative'}); /*var distance = speed/pageFps;*/ if(direction == 'top'){ $(cla).find('.list-scroll').css({'transform':'translateY('+ parseInt(sNum)+'px)'}); if (sNum + listH >0){ sNum = sNum - speed; }else{ sNum = sNum - speed - speed + listH; } } if(direction == 'left'){ $(cla).find('.list-scroll').css({'transform':'translateX('+ parseInt(sNum)+'px)','display':'flex'}); if (sNum + listW >0){ sNum = sNum - speed; }else{ sNum = sNum - speed - speed + listW; } } if(hoverIs){ requestAnimationFrame(listGo); } } } } //模拟表单提交 function formSubmit(url,type,postData,pjaxIs) { if(pjaxIs){ postData.tags = postData.tags.toString(); $.pjax({url:url,type:type,data:postData,dataType:'html',container:'#pjax-container',fragment: '#pjax-container', timeout: 10000}); }else{ var tempform = document.createElement("form"); $(tempform).attr('data-pjax',url); tempform.action = url; tempform.method = type; tempform.style.display = "none"; console.log(tempform); for (var x in postData) { var opt = document.createElement("textarea"); opt.name = x; opt.value = postData[x]; tempform.appendChild(opt); } document.body.appendChild(tempform); tempform.submit(); } }