|
@@ -0,0 +1,83 @@
|
|
|
+<meta http-equiv="content-type" content="text/html;charset=UTF-8">
|
|
|
+
|
|
|
+<style>
|
|
|
+ .form-appraise{
|
|
|
+ }
|
|
|
+ .form-tip{
|
|
|
+ color: red;
|
|
|
+ }
|
|
|
+ .form-position{
|
|
|
+ margin-left: 128px;
|
|
|
+ }
|
|
|
+</style>
|
|
|
+
|
|
|
+
|
|
|
+<div class="form-position">
|
|
|
+ <form method="POST" id="appraise"></form>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script type="text/javascript" src="http://file.5tangs.com/2018-February-11-16-3-35-jquery-1.11.2.min.js"></script>
|
|
|
+<script>
|
|
|
+ // 添加去除字符串空格方法
|
|
|
+ if (!String.prototype.trimSpace){
|
|
|
+ String.prototype.trimSpace = function () {
|
|
|
+ return this.replace(/(^\s*)|(\s*$)/g, "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 提交评价的表单,动态插入
|
|
|
+ var formHTML = "<p>\n" +
|
|
|
+ " <span class=\"form-tip\">* </span>\n" +
|
|
|
+ " <input id=\"name\" type=\"text\" name=\"name\" placeholder=\"输入用户名\" class=\"form-appraise\">\n" +
|
|
|
+ " </p>\n" +
|
|
|
+ " <p>\n" +
|
|
|
+ " <span class=\"form-tip\">* </span>\n" +
|
|
|
+ " <input id=\"email\" type=\"text\" name=\"email\" placeholder=\"输入邮箱\" class=\"form-appraise\">\n" +
|
|
|
+ " </p>\n" +
|
|
|
+ " <p>\n" +
|
|
|
+ " <span class=\"form-tip\">* </span>\n" +
|
|
|
+ " <textarea id=\"content\" rows=\"12\" cols=\"48\"></textarea>\n" +
|
|
|
+ " </p>\n" +
|
|
|
+ " <p>\n" +
|
|
|
+ " <span id=\"content-tip\" class=\"form-tip\"></span>\n" +
|
|
|
+ " </p>\n" +
|
|
|
+ " <span class=\"form-tip\">* 邮箱信息不会向外公开(只为交流,禁止灌水)</span>\n" +
|
|
|
+ " <p>\n" +
|
|
|
+ " <input type=\"submit\" onclick=\"appraise()\">\n" +
|
|
|
+ " </p>\n";
|
|
|
+
|
|
|
+ var whitePath = [
|
|
|
+ "/ghost/",
|
|
|
+ ];
|
|
|
+ var pathname = window.location.pathname;
|
|
|
+
|
|
|
+ var appraiseShow = true;
|
|
|
+ if (pathname == "/"){
|
|
|
+ appraiseShow = false;
|
|
|
+ } else {
|
|
|
+ for (var i = 0; i < whitePath.length; i++) {
|
|
|
+ if (pathname.toString().indexOf(whitePath[i]) > 0) {
|
|
|
+ console.log("pathname is", pathname);
|
|
|
+ appraiseShow = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("appraise isShow:", appraiseShow);
|
|
|
+ if (appraiseShow){
|
|
|
+ $("#appraise").append(formHTML);
|
|
|
+ }
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<script>
|
|
|
+ function appraise() {
|
|
|
+ var name = $("#name").val().toString().trimSpace();
|
|
|
+ var email = $("#email").val().toString().trimSpace();
|
|
|
+ var content = $("#content").val().toString().trimSpace();
|
|
|
+ if (name.length < 1 || email.length < 1 || content.length < 1){
|
|
|
+ $("#content-tip").html("你有必填内容没有填完!!!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|