标签:
document.writeln("<div id=\"tanchuangwai\" class=\"tanchuangwai\" style=\"z-index:999;overflow:hidden;font-family:微软雅黑; background:#6cadde; width:236px; height:29px; line-height:29px; float:left; border-radius:3px 3px 0 0; position:fixed; bottom:0; right:0;\">"); document.writeln(" <h3 style=\" height:29px; width:100px; color:#ffffff; font-size:12px; float:left; padding:0 0 0 10px; font-weight:normal; margin:0;\">请您留言</h3>"); document.writeln(" <span id=\"dakai\" class=\"guanbi\" style=\" color:#ffffff; font-size:11px; height:29px; float:right; margin:0 5px 0 0; cursor:pointer;\" id=\"guanbi\" onclick=\"goPanel();\">打开</span></div>"); document.writeln("<div id=\"tanchuang\" class=\"tanchuang\" style=\"z-index:999;overflow:hidden;font-family:微软雅黑; position:fixed; width:236px; background:#ffffff; right:0; bottom:0px; display:none;\">"); document.writeln(" <div style=\"background:#6cadde; width:236px; height:29px; line-height:29px; float:left; border-radius:3px 3px 0 0;\">"); document.writeln(" <h3 style=\" height:29px; width:100px; color:#ffffff; font-size:12px; float:left; padding:0 0 0 10px; font-weight:normal; margin:0;\">请您留言</h3>"); document.writeln(" <span id=\"guanbi\" class=\"guanbi\" style=\" color:#ffffff; font-size:11px; height:29px; float:right; margin:0 5px 0 0; cursor:pointer;\" onclick=\"goClose();\">关闭</span></div>"); document.writeln(" <div style=\" width:194px; float:left; padding:0 20px; border-left:1px solid #6cadde; border-right:1px solid #6cadde; border-bottom:1px solid #6cadde; background:#f5f5f5;\">"); document.writeln(" <textarea id=\"pArea\" style=\" font-family:微软雅黑; width:182px; height:80px; border:1px solid #cccccc; background:#ffffff; padding:5px; color:#a9a9a9; font-size:12px; line-height:20px; float:left; margin:10px 0 10px 0;\" placeholder=\"请输入问题描述\"></textarea>"); document.writeln(" <div style=\"width:192px; border:1px solid #cccccc; height:20px; line-height:20px; float:left; margin:0 0 10px 0;\"><span style=\" width:32px; height:20px; font-size:12px; color:#666666; text-align:center; float:left; background:#f2f2f2; border-right: 1px solid #cccccc;\">类型</span>"); document.writeln(" <select id=\"pSel\" name=\"select\" style=\" font-family:微软雅黑; background:#ffffff; float:left; border:none; color:#a9a9a9; padding:0 0 0 7px; width:159px;\">"); document.writeln(" <option value=\"系统异常\">系统异常</option>"); document.writeln(" <option value=\"功能操作\">功能操作</option>"); document.writeln(" <option value=\"功能体验\">功能体验</option>"); document.writeln(" </select>"); document.writeln(" </div>"); document.writeln(" <div style=\"width:192px; border:1px solid #cccccc; height:20px; line-height:20px; float:left; margin:0 0 10px 0;\"><span style=\" width:32px; height:20px; font-size:12px; color:#666666; text-align:center; float:left; background:#f2f2f2; border-right: 1px solid #cccccc;\">姓名</span>"); document.writeln(" <input id=\"pName\" type=\"text\"/ placeholder=\"请输入您的姓名\" style=\" font-family:微软雅黑; background:#ffffff; float:left; border:none; color:#a9a9a9; padding:0 0 0 10px; width:149px;\">"); document.writeln(" </div>"); document.writeln(" <div style=\"width:192px; border:1px solid #cccccc; height:20px; line-height:20px; float:left; margin:0 0 10px 0;\"><span style=\" width:32px; height:20px; font-size:12px; color:#666666; text-align:center; float:left; background:#f2f2f2; border-right: 1px solid #cccccc;\">电话</span>"); document.writeln(" <input id=\"pTel\" type=\"text\"/ placeholder=\"请输入您的电话\" style=\" font-family:微软雅黑; background:#ffffff; float:left; border:none; color:#a9a9a9; padding:0 0 0 10px; width:149px;\">"); document.writeln(" </div>"); document.writeln(" <input style=\" font-family:微软雅黑; background:#6cadde; border-radius:5px; width:91px; height:23px; text-align:center; color:#000000; line-height:23px; margin:10px 51px; border:none; cursor:pointer;\" type=\"button\" value=\"提交\" onclick=\"sub();\" />"); document.writeln(" </div>"); document.writeln("</div>"); var url = "XXX"; var par; var a = document.getElementById("tanchuangwai"); var b = document.getElementById("guanbi"); var p; var s; var h; function goPanel(){ document.getElementById("tanchuangwai").style.display = "none"; p = document.getElementById("tanchuang"); p.style.display = "block"; p.style.height = "29px"; s = setInterval(upPanel,1); } function goClose(){ p = document.getElementById("tanchuang"); h = setInterval(downPanel,1); } function upPanel(){ var height = parseInt(p.style.height.replace("px","")); height = height + 3; p.style.height = height+"px"; if(height >= 281){ clearInterval(s); } } function downPanel(){ var height = parseInt(p.style.height.replace("px","")); height = height - 3; p.style.height = height+"px"; if(height <= 29){ clearInterval(h); p.style.display = "none"; document.getElementById("tanchuangwai").style.display = "block"; } } function ajax(){ var oAjax = null; if(window.XMLHttpRequest){ oAjax = new XMLHttpRequest(); }else{ oAjax = new ActiveXObject("Microsoft.XMLHTTP"); }; oAjax.open(‘POST‘, url, true); oAjax.setRequestHeader("Content-type","application/x-www-form-urlencoded"); var area = document.getElementById("pArea").value; var sel = document.getElementById("pSel").value; var name = document.getElementById("pName").value; var tel = document.getElementById("pTel").value; var url1 = window.location.href; oAjax.send("area=" + area + "&sel=" + sel + "&name=" + name + "&tel=" + tel + "&par=" + par + "&url=" + url1); oAjax.onreadystatechange = function(){ if(oAjax.readyState == 4){ if(oAjax.status == 200){ alert(oAjax.responseText) }else{ alert("请求错误"); } } }; } function sub() { var js = document.getElementsByTagName("script"); for (var i = 0; i < js.length; i++) { if (js[i].src.indexOf("panel.min.js") >= 0) { var arraytemp = new Array(); arraytemp = js[i].src.split(‘?‘); arraytemp = arraytemp[1].split(‘=‘); if (arraytemp[0] == ‘value‘) { par = arraytemp[1]; } } }; ajax(); }
一个问题提交的实例(js原生动画,原生ajax,js引用加参数)
标签:
原文地址:http://www.cnblogs.com/wpcnblog/p/5486385.html