笑脸不显示在输入框codeigniter中

时间:2018-02-26 10:51:29

标签: php codeigniter

我正在使用笑脸助手来展示和存放笑脸。笑脸已显示在生成的表格视图中。点击笑脸,相应的文字显示不是笑脸。这是我在Library中的代码,

 public function get_smiles() 
{
$CI =& get_instance();
$CI->load->helper('smiley');
$CI->load->library('table');
$image_array = get_clickable_smileys('images/smileys/', 'editor-textarea');
$col_array = $CI->table->make_columns($image_array, 8);
$array['smiley_table'] = $CI->table->generate($col_array);
return  $array['smiley_table'];
}

在视图中,

<?php echo smiley_js(); ?>
<textarea name="editor-textarea" class="editor-textarea" id="editor-textarea"><textarea>

<ul>
  <li>
  <?php $smiles = $this->common->get_smiles(); ?>
  <?php echo $smiles; ?>
 </li>

我该如何解决这个问题?

笑脸js

 <script type="text/javascript">
   /*<![CDATA[ */var smiley_map = {};

        function insert_smiley(smiley, field_id) {
            var el = document.getElementById(field_id), newStart;

            if ( ! el && smiley_map[field_id]) {
                el = document.getElementById(smiley_map[field_id]);

                if ( ! el)
                    return false;
            }

            el.focus();
            smiley = " " + smiley;

            if ('selectionStart' in el) {
                newStart = el.selectionStart + smiley.length;

                el.value = el.value.substr(0, el.selectionStart) +
                                smiley +
                                el.value.substr(el.selectionEnd, el.value.length);
                el.setSelectionRange(newStart, newStart);
            }
            else if (document.selection) {
                document.selection.createRange().text = smiley;
            }
        }// ]]>
        </script>

0 个答案:

没有答案