zoukankan      html  css  js  c++  java
  • fckeditor配置

    <!DOCTYPE html>
    <html >
    <head>
        <title>发布</title>
        <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
        <link href="../../../css/jquerymobile/jquery.mobile-1.3.2.min.css" rel="stylesheet" type="text/css" />
        <script src="../../../js/jquery.js" type="text/javascript"></script>
        <script src="../../../js/jquerymobile/jquery.mobile-1.3.2.js" type="text/javascript"></script>
        <script src="../../../fckeditor/fckeditor.js" type="text/javascript"></script>
        
        <style type="text/css">
            p{ padding:0px; margin:0px}
        </style>
    
        <script type="text/javascript">
            $(document).bind('pagebeforechange', function (e, data) {
                if (typeof data.toPage !== "string") {
                    var url = e.target.baseURI;
                    var o = getUrlParam(url);
                    window.localStorage.setItem("local_artid", o.id);
                    
                    getArt(o.id);
                }
            });
    
            $(function () {
                $("#btnSend").click(function () {
                    saveMyArt();
                });
                $("input[type='checkbox']").bind('click', function () {
                    if ($(this).prop("checked")) {
                        $(this).attr("checked", true).checkboxradio("refresh");
                    } else {
                        $(this).attr("checked", false).checkboxradio("refresh");
                    }
                });
            })
            function getUrlParam(string) {
                var obj = {};
                if (string.indexOf("?") != -1) {
                    var string = string.substr(string.indexOf("?") + 1);
                    var strs = string.split("&");
                    for (var i = 0; i < strs.length; i++) {
                        var tempArr = strs[i].split("=");
                        obj[tempArr[0]] = unescape(tempArr[1]);
                    }
                }
                return obj;
            }
            function getArt(id) {
                $.ajax({
                    url: "../../service/salesarts.ashx",
                    type: "POST",
                    dataType: "json",
                    data: "artid=" + id + "&method=getartbyartid&arttype=2",
                    success: function (data) {
                        var s = "";
                        $.each(data.ds, function (index, content) {
                            $("#title").text(content.Topic);
                            $("#artcontent").html(content.ArtContent);
                            window.localStorage.setItem("local_keyword",content.KeyWord);
                        })
                    }
                });
            }
            function saveMyArt() {
                var result=0;
                var artid=window.localStorage.getItem("local_artid");
                var disid=window.localStorage.getItem("local_disid");
                var disno = window.localStorage.getItem("local_disno");
                var sendstatus = 1;
                var title = $("#topic").val();
                var topic = "";
                if (title == "") {
                    topic = $("#title").text();
                } else {
                    topic = title;
                }
                var keyword = window.localStorage.getItem("local_keyword");
                var artcontent = $("#artcontent").html();
                
                if ($("#IsSales").prop("checked") == true) {
                    result = 1;
                }
                var issales=result;
                if ($("#IsProduct").prop("checked") == true) {
                    result=1;
                }
                var isproduct=result;
                if ($("#IsContact").prop("checked") == true) {
                    result=1;
                }
                var iscontact=result;
                if ($("#IsOrder").prop("checked") == true) {
                    result=1;
                }
                var isorder = result;
                
                $.ajax({
                    url: "../../service/salesarts.ashx",
                    type:"POST",
                    dataType:"text",
                    data: "artid=" + artid + "&disid=" + disid + "&disno=" + disno + "&topic=" + topic + "&keyword=" + keyword + "&sendstatus=" + sendstatus + "&artcontent=" + escape(artcontent) + "&issales=" + issales + "&isproduct=" + isproduct + "&iscontact=" + iscontact + "&isorder=" + isorder + "&method=savemyart&arttype=2",
                    success:function(data){
                        //data:1保存成功 2发布成功 0失败
                        if(data=="true"){
                            alert("发布成功!");
                            window.location.href = "list.html"
                        }else{
                            alert("发布失败");
                        }
                    }
                });
            } 
        </script>
    </head>
    <body>
        <div data-role="page">
            <div data-role="header">
                <p>
                    <a href="../../member/member.html" data-role="button" data-inline="true">会员主页</a>
                    <a href="../../member/contact.html" data-role="button" data-inline="true">联系客户</a>
                    <a href="../../member/login.html" data-role="button" data-inline="true"> 退出</a>
                </p>
            </div>
            <form id="form1">
            <div data-role="content">
                <div data-role="fieldcontain">
                    <span>原标题</span>
                    <label id="title"></label>
                </div>
                <div data-role="fieldcontain">
                    <input type="text" id="topic" placeholder="新标题" />
                </div>
                <div data-role="fieldcontain">
                    <script type="text/javascript">
                        var oFCKeditor = new FCKeditor('FCKeditor1');
                oFCKeditor.BasePath = "/fckeditor/"; oFCKeditor.Create();
    </script>
    </div> <div data-role="fieldcontain" data-type="horizontal"> <label><input type="checkbox" name="IsSales" id="IsSales" data-mini="true" />营销信息</label> <label><input type="checkbox" name="IsProduct" id="IsProduct" data-mini="true" />产品信息</label> <label><input type="checkbox" name="IsContact" id="IsContact" data-mini="true" />联系信息</label> <label><input type="checkbox" name="IsOrder" id="IsOrder" data-mini="true" />订购信息</label> </div> <div data-role="fieldcontain"> <input type="button" id="btnSend" value="发布" /> </div> </div> </form> </div> </body> </html>

  • 相关阅读:
    javascript实现简单的轮播图片
    用struts实现简单的登录
    非非是
    javabean连数据库
    超级迷宫 nabc
    我的Time
    SQL SERVER 2008 评估期已过
    《架构漫谈》有感
    c#
    与String有关的强制转换
  • 原文地址:https://www.cnblogs.com/ymh2013/p/3777787.html
Copyright © 2011-2022 走看看