Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/410.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在实现ckeditor后必须进行哪些更改_Javascript_Html - Fatal编程技术网

Javascript 在实现ckeditor后必须进行哪些更改

Javascript 在实现ckeditor后必须进行哪些更改,javascript,html,Javascript,Html,想法: <div id="middlePanel"> <table style="background-color:#FFF; border:#069 1px solid; border-top:none;" width="100%" border="0" align="center" cellpadding="12" cellspacing=&quo

想法:

<div id="middlePanel">
    <table style="background-color:#FFF; border:#069 1px solid; border-top:none;" width="100%" border="0" align="center" cellpadding="12" cellspacing="0">
      <tr>
        <td width="80%" valign="top">
          <h2><?php echo $forum_section_title; ?></h2>
          <div id="breadcrumbs"><a href="forumhome.php">Forum</a>&larr;<a href="sections.php?id=<?php echo $forum_section_id; ?>"><?php echo $forum_section_title; ?></a></div><br /><br />
          <h2>Creating New Topic In the  <em><?php echo $forum_section_title; ?></em>&nbsp; Forum</h2>
          <form action="php_parsers/forumpost_system.php" method="post" name="form1" id="form1">
            <input name="post_type" type="hidden" value="a" />
            Topic Author:<br /><input name="topic_author" type="text" disabled="disabled" maxlength="64" style="width:96%;" value="<?php echo $log_username; ?>" />
            <br /><br />
            Please type in a title for your topic here:<br /><input name="post_title" type="text" maxlength="64" style="width:96%;" /><br /><br />
            Please type in your topic body:<br />
            <textarea name="post_body" id="post_body" rows="15" style="width:96%;"></textarea>
            <script>
            CKEDITOR.replace( 'post_body' );
            </script>
            <!--<iframe name="richTextField" id="richTextField" style="border:#000000 1px solid; width:700px; height:300px;"></iframe>-->
            <br /><br />
            <input name="" type="submit" value="Create my topic now!" onclick="validateMyForm();"/>
            <input name="fsid" type="hidden" value="<?php echo $forum_section_id; ?>"/>
            <input name="fstitle" type="hidden" value="<?php echo $forum_section_title; ?>"/>
            <input name="uid" type="hidden" value="<?php echo $log_id; ?>"/>
            <input name="uname" type="hidden" value="<?php echo $log_username; ?>"/>
            <input name="upass" type="hidden" value="<?php echo $log_password; ?>"/>
          </form>
        </td>
        <td width="20%" valign="top">&nbsp;</td>
      </tr>
  </table>
  </div>
我正在使用CKEditor在我的网站论坛上发布问题

问题:

<div id="middlePanel">
    <table style="background-color:#FFF; border:#069 1px solid; border-top:none;" width="100%" border="0" align="center" cellpadding="12" cellspacing="0">
      <tr>
        <td width="80%" valign="top">
          <h2><?php echo $forum_section_title; ?></h2>
          <div id="breadcrumbs"><a href="forumhome.php">Forum</a>&larr;<a href="sections.php?id=<?php echo $forum_section_id; ?>"><?php echo $forum_section_title; ?></a></div><br /><br />
          <h2>Creating New Topic In the  <em><?php echo $forum_section_title; ?></em>&nbsp; Forum</h2>
          <form action="php_parsers/forumpost_system.php" method="post" name="form1" id="form1">
            <input name="post_type" type="hidden" value="a" />
            Topic Author:<br /><input name="topic_author" type="text" disabled="disabled" maxlength="64" style="width:96%;" value="<?php echo $log_username; ?>" />
            <br /><br />
            Please type in a title for your topic here:<br /><input name="post_title" type="text" maxlength="64" style="width:96%;" /><br /><br />
            Please type in your topic body:<br />
            <textarea name="post_body" id="post_body" rows="15" style="width:96%;"></textarea>
            <script>
            CKEDITOR.replace( 'post_body' );
            </script>
            <!--<iframe name="richTextField" id="richTextField" style="border:#000000 1px solid; width:700px; height:300px;"></iframe>-->
            <br /><br />
            <input name="" type="submit" value="Create my topic now!" onclick="validateMyForm();"/>
            <input name="fsid" type="hidden" value="<?php echo $forum_section_id; ?>"/>
            <input name="fstitle" type="hidden" value="<?php echo $forum_section_title; ?>"/>
            <input name="uid" type="hidden" value="<?php echo $log_id; ?>"/>
            <input name="uname" type="hidden" value="<?php echo $log_username; ?>"/>
            <input name="upass" type="hidden" value="<?php echo $log_password; ?>"/>
          </form>
        </td>
        <td width="20%" valign="top">&nbsp;</td>
      </tr>
  </table>
  </div>
当我在post_body textarea中输入问题并点击create topic时,发生了以下情况:-

  • 首先,弹出一个警告框,说“请在 body”(请注意body textarea不为空)

  • 然后,我立即被重定向到主题(请注意,正文中发布的内容将被插入到数据库表中)

我不想让那个警报框弹出。我该怎么办

代码:

<div id="middlePanel">
    <table style="background-color:#FFF; border:#069 1px solid; border-top:none;" width="100%" border="0" align="center" cellpadding="12" cellspacing="0">
      <tr>
        <td width="80%" valign="top">
          <h2><?php echo $forum_section_title; ?></h2>
          <div id="breadcrumbs"><a href="forumhome.php">Forum</a>&larr;<a href="sections.php?id=<?php echo $forum_section_id; ?>"><?php echo $forum_section_title; ?></a></div><br /><br />
          <h2>Creating New Topic In the  <em><?php echo $forum_section_title; ?></em>&nbsp; Forum</h2>
          <form action="php_parsers/forumpost_system.php" method="post" name="form1" id="form1">
            <input name="post_type" type="hidden" value="a" />
            Topic Author:<br /><input name="topic_author" type="text" disabled="disabled" maxlength="64" style="width:96%;" value="<?php echo $log_username; ?>" />
            <br /><br />
            Please type in a title for your topic here:<br /><input name="post_title" type="text" maxlength="64" style="width:96%;" /><br /><br />
            Please type in your topic body:<br />
            <textarea name="post_body" id="post_body" rows="15" style="width:96%;"></textarea>
            <script>
            CKEDITOR.replace( 'post_body' );
            </script>
            <!--<iframe name="richTextField" id="richTextField" style="border:#000000 1px solid; width:700px; height:300px;"></iframe>-->
            <br /><br />
            <input name="" type="submit" value="Create my topic now!" onclick="validateMyForm();"/>
            <input name="fsid" type="hidden" value="<?php echo $forum_section_id; ?>"/>
            <input name="fstitle" type="hidden" value="<?php echo $forum_section_title; ?>"/>
            <input name="uid" type="hidden" value="<?php echo $log_id; ?>"/>
            <input name="uname" type="hidden" value="<?php echo $log_username; ?>"/>
            <input name="upass" type="hidden" value="<?php echo $log_password; ?>"/>
          </form>
        </td>
        <td width="20%" valign="top">&nbsp;</td>
      </tr>
  </table>
  </div>

&larr

在论坛中创造新话题
主题作者:
您没有告诉CKEditor更新原始的
元素

当您使用CKEditor时,编辑器将使用
的内容来填充自身-当您提交表单时,编辑器将自动使用编辑器的编辑内容更新该

您需要做的是强制它在检查元素内容之前提前更新元素

因此,在测试
document.form1.post\u body.value
之前,请尝试运行以下代码位

CKEDITOR.instances.post_body.updateElement();

我猜这个警报来自于一些javascript,你决定(出于某种原因)不给我们看?我已经更新了qn。请检查一下。