我的代码没有从tinymce.min.js加载textarea,我已经包含了所有内容,我也试过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>
答案 0 :(得分:1)
在tinymce.init({selector:'textarea'});
元素的HTML存在之前,您正在调用textarea
。此脚本与页面加载一起内联运行,因此您必须在textarea
元素之后的某处移动脚本,或者创建onload
事件处理程序。