fckeditor 구성

14668 단어
<!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>

좋은 웹페이지 즐겨찾기