javascript - 我的代码没有从 tinymce.min.js 加载文本区域

标签 javascript php jquery html css

我的代码没有从 tinymce.min.js 加载文本区域,我已经包含了所有内容并且我也尝试过 DTEDITOR 不记得名字但仍然没有解决方案:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Admin Area    </title>
        <script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
        <script>
            tinymce.init({selector:'textarea'});    
        </script>
    </head>

    <body bgcolor="grey">
    <form method="post" action="insert_product.php" enctype="multipart/form-  data">
    <table width="700" align="center" border="1" bgcolor="#006699">
        <tr align="center">
            <td colspan="2">     
                <h2> Insert new Product</h2>     
            </td>
        </tr>
        <tr>
            <td align="right">   
                <b>Product Title</b>    
            </td>
            <td>     
                <input type="text" name="product_title" size="50"/>     
            </td>
        </tr>
        <tr>
            <td align="right">    
                <b>Product Category</b>    
            </td>
            <td>     
                <select name="product_cart">
                    <option>Select a Category</option>
                    <?php
                        $get_brands="select * from brands";
                        $run_brands=mysqli_query($con, $get_brands);
                        while($row_brands=mysqli_fetch_array( $run_brands)){
                            $brand_id = $row_brands['brand_id'];
                            $brand_title=$row_brands['brand_title'];            
                            echo "<option value='$brand_id'>$brand_title </option>";
                        }
                    ?>
                </select>
             </td>
        </tr>
        <tr>
            <td align="right">    
                <b>Product image 1</b>    
            </td>
            <td>     
                <input type="file" name="product_img1"/>     
            </td>
        </tr>
        <tr>
            <td align="right">
                <b>Product image 2</b>    
            </td>
            <td>     
                <input type="file" name="product_img2"/>     
            </td>
        </tr>
        <tr>
            <td align="right">    
                <b>Product image 3</b>    
            </td>
            <td>     
                <input type="file" name="product_img3"/>     
            </td>
        </tr>
        <tr>
            <td align="right">    
                <b>Product price</b>    
            </td>
            <td>     
                <input type="text" name="product_price"/>     
            </td>
        </tr>
        <tr>
            <td align="right">    
                <b>Product Description</b>    
            </td>
            <td>     
                <textarea name="product_desc" cols="35" rows="10" ></textarea>     
            </td>

        </tr>
        <tr>
            <td align="right">    
                <b>Product Keywords</b>    
            </td>
            <td>     
                <input type="text" name="product_keywords" size="50"/>     
            </td>
        </tr>
        <tr align="center">
            <td colspan="2">     
                <input type="submit" name="submit"/>     
            </td>
        </tr>
    </body>
</htmal>

最佳答案

您在 textarea 元素的 HTML 存在之前调用 tinymce.init({selector:'textarea'});。此脚本与页面加载内联运行,因此您必须将脚本移动到 textarea 元素之后的某处,或者创建一个 onload 事件处理程序。

关于javascript - 我的代码没有从 tinymce.min.js 加载文本区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30060085/

相关文章:

Javascript替换类中的全局参数

javascript - 使用 html() 时看不到 jQuery 检查的属性

php - 定义 ('WP_DEBUG' ,真);不显示错误

php - 计算查询中的一行在所有表中出现的次数

php - 浏览器关闭时使自定义 PHP session 过期

jquery - $.ajax ColdFusion cfc JSON Hello World

javascript - jQuery.parseJSON 无法解析序列化的 C# 字典

javascript - Google Invisible ReCaptcha 不可见

Javascript:无法让 document.getelementbyid 工作

javascript - 如何使用 javascript 查找和突出显示文本,甚至在某些元素中标记了文本?