简体   繁体   English

TinyMCE Jquery不能正常工作

[英]TinyMCE Jquery not working fine

Hi I had used TinyMCE in my code single page code to upload data into server using TinyMCE . 您好我曾使用TinyMCE在我的代码单页代码中使用到的数据上传到服务器TinyMCE My Code is as follows, this is the add.php page : 我的代码如下,这是add.php页面:

<?php

$msg="";
include("config.php");
    if($_POST['title']!= ""){
        $title= $_POST['title'];
        $words= $_POST['words'];
        $words= stripslashes($words);

            if (!$title)
            {
                $msg="Please Enter Title";
            } elseif (!$words)
            {
                $msg="Please enter the Blog";
            }
            $query= mysql_query("INSERT INTO editor (title, content) VALUES ($title, $words)") or die (mysql_error());
            $msg="Success!";
            }
?>

<! DOCTYPE html>
<html>
    <head>
        <title>Add New Blog</title>
        <script type="text/javascript" src="jquery-1.11.0"></script>
        <script type="text/javascript" src="tinymce.min"></script>
        <script type="text/javascript" src="jquery.tinymce.min"></script>
    </head>
<body>
    <div>
        <p><b>Add a New Blog</b></p>
            <form action="add.php" method="post">
                Title of the Blog :
                <br/>
                <input type="text" name="title"></input>
                <br/>
                Your Blog :
                <br/>
                <textarea name="words" class="tinymce" cols="30" rows="10"></textarea>
                <br/>
                <input type="submit" value="submit"/> <?php echo $msg; ?>
            </form>
    </div>
</body>
</html>

My Textarea is displayed as a normal textarea , the data is also not going into the Database. 我的Textarea显示为普通textarea ,数据也不会进入数据库。 The config.php file is for Database connection and it is working fine, I checked it. config.php文件用于数据库连接,它工作正常,我检查了它。

Please help, Thanks in advance. 请帮助,提前致谢。

You forgot to add extension in linked script file 忘记链接的脚本文件中 添加扩展名

    <script type="text/javascript" src="jquery-1.11.0.js"></script>
    <script type="text/javascript" src="tinymce.min.js"></script>
    <script type="text/javascript" src="jquery.tinymce.min.js"></script>

Check this Sample Demo 检查此示例演示

I think you are added two TinyMCE library so it's may be conflict problem . 我认为你添加了两个TinyMCE库,所以它可能是冲突问题 So please update only this two library 所以请只更新这两个库

I am add only 2 library 添加了2个库

  1. JQuery Library - http://code.jquery.com/jquery-1.11.0.min.js JQuery库 - http://code.jquery.com/jquery-1.11.0.min.js
  2. TinyMCE Library - http://tinymce.cachefly.net/4.0/tinymce.min.js TinyMCE库 - http://tinymce.cachefly.net/4.0/tinymce.min.js

And In your Header add this script 在你的Header中添加这个脚本

<script>
    tinymce.init({
         selector: "textarea"
    });
</script>

try now its work. 现在尝试它的工作。

<! DOCTYPE html>
<html>
    <head>
        <title>Add New Blog</title>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
        <script type="text/javascript" src="http://tinymce.cachefly.net/4.0/tinymce.min.js"></script>
        <script>
            tinymce.init({
                 selector: "textarea"
            });
        </script>
    </head>
<body>
    <div>
        <p><b>Add a New Blog</b></p>
            <form action="add.php" method="post">
                Title of the Blog :
                <br/>
                <input type="text" name="title"></input>
                <br/>
                Your Blog :
                <br/>
                <textarea name="words" class="tinymce" cols="30" rows="10"></textarea>
                <br/>
                <input type="submit" value="submit"/> <?php echo $msg; ?>
            </form>
    </div>
</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM