我做了一个测试页面,您可以帮我看一下,每次一进入或一刷新页面一定会进入SPAW里面.
http://www.3asoft.com/test.php

解决方案 »

  1.   

    <?php
      session_start();
      include("head.php");
    ?><table width=755 align="center">
    <tr>
     <td width="20%" valign="top" bgcolor="#DAF3DA">
     </td>
     <td width="80%" valign="top" align=center>
      <table>
    <center>
    <form method="post" action="pbbasic_insert.php" enctype="multipart/form-data">
        <tr>
          <td width="100" valign="top">
          <table border="0" width="100%">
    <tr>
              <td colspan="5"  width="100%" bgcolor="#99CCFF">企业基本信息</td>
            </tr>
            <tr>
              <td height="19">地址:</td>
              <td colspan="4" height="19"><input type="text" name="T9" size="50"></td>
            </tr>
            <tr>
              <td height="19">邮编:</td>
              <td colspan="3" height="19"><input type="text" name="T10" size="20"></td>
              <td height="19"> </td>
            </tr>
            <tr>
              <td height="19">电邮:</td>
              <td colspan="4" height="19"><input type="text" name="T11" size="50"></td>
            </tr>
    <tr>
      <td colspan="5"  width="100%" height="19"> </td>
            </tr> <tr>
      <td colspan="5"  width="100%" bgcolor="#99CCFF">备注</td>
            </tr>     <tr>
          <td colspan="5" height="19" width="100%">
    <?
    include "spaw/spaw_control.class.php";
    $sw = new SPAW_Wysiwyg('nr',stripslashes($_POST['nr']),
      'zh-gb2312' /*language*/, 'default' /*toolbar mode*/, 'default' /*theme*/,
                          'default' /*width*/, '150px' /*height*/);
    $sw->show();
    ?>
      </td>
        </tr>
    <tr>
              <td colspan="5"  width="100%" bgcolor="#99CCFF">企业属性</td>
            </tr> <tr>
              <td colspan="5" width="100%">
              <table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
                <tr>
                  <td width="20%"><input type="checkbox" name="C17" value="ON">制造</td>
                  <td width="20%"><input type="checkbox" name="C18" value="ON">贸易/批零</td>
                  <td width="20%"><input type="checkbox" name="C19" value="ON">服务</td>
                  <td width="20%"><input type="checkbox" name="C20" value="ON">政府机关</td>
                  <td width="20%"> </td>
                </tr>
                <tr>
                  <td width="20%"><input type="checkbox" name="C1" value="ON">浮法玻璃</td>
                  <td width="20%"><input type="checkbox" name="C6" value="ON">贸易1</td>
                  <td width="20%"><input type="checkbox" name="C13" value="ON">服务1</td>
                  <td width="20%"><input type="checkbox" name="C27" value="ON">政府1</td>
                  <td width="20%"> </td>
                </tr>
              </table>
      </td>
        </tr> <tr>
          <td colspan="5" width="100%">
        <p align="center"><input type="submit" value="提交" name="B1">&nbsp;&nbsp;&nbsp;<input type="reset" value="重置" name="B2"></p>
      </td>
    </tr>  </table></form>
    </center>
    </table>
       </td>
     </tr>
    </table><?php
       include("footer.php");
    ?>
      

  2.   

    很奇怪,在我这里这样的代码中spaw并为获得焦点,焦点在submit按钮上。
    你还做了什么设置?
      

  3.   

    我未作其它设置。
    spaw_control.config.php 的配置全文如下:<?php 
    // ================================================
    // SPAW PHP WYSIWYG editor control
    // ================================================
    // Configuration file
    // ================================================
    // Developed: Alan Mendelevich, [email protected]
    // Copyright: Solmetra (c)2003 All rights reserved.
    // ------------------------------------------------
    //                                www.solmetra.com
    // ================================================
    // v.1.0, 2003-03-27
    // ================================================// directory where spaw files are located
    $spaw_dir = '/spaw/';// base url for images
    // $spaw_base_url = 'http://spaw/'; 原始
     $spaw_base_url = '/'; if (!ereg('/$', $HTTP_SERVER_VARS['DOCUMENT_ROOT']))
      $spaw_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'].$spaw_dir;
    else
      $spaw_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'].substr($spaw_dir,1,strlen($spaw_dir)-1);
      $spaw_default_toolbars = 'default';
    $spaw_default_theme = 'default';
    $spaw_default_lang = 'zh-gb2312';
    $spaw_default_css_stylesheet = $spaw_dir.'wysiwyg.css';// add javascript inline or via separate file
    $spaw_inline_js = false;// use active toolbar (reflecting current style) or static
    $spaw_active_toolbar = true;// default dropdown content
    $spaw_dropdown_data['style']['default'] = 'Normal';$spaw_dropdown_data['font']['Arial'] = 'Arial';
    $spaw_dropdown_data['font']['Courier'] = 'Courier';
    $spaw_dropdown_data['font']['Tahoma'] = 'Tahoma';
    $spaw_dropdown_data['font']['Times New Roman'] = 'Times';
    $spaw_dropdown_data['font']['Verdana'] = 'Verdana';$spaw_dropdown_data['fontsize']['1'] = '1';
    $spaw_dropdown_data['fontsize']['2'] = '2';
    $spaw_dropdown_data['fontsize']['3'] = '3';
    $spaw_dropdown_data['fontsize']['4'] = '4';
    $spaw_dropdown_data['fontsize']['5'] = '5';
    $spaw_dropdown_data['fontsize']['6'] = '6';$spaw_dropdown_data['paragraph']['Normal'] = 'Normal';
    $spaw_dropdown_data['paragraph']['Heading 1'] = 'Heading 1';
    $spaw_dropdown_data['paragraph']['Heading 2'] = 'Heading 2';
    $spaw_dropdown_data['paragraph']['Heading 3'] = 'Heading 3';
    $spaw_dropdown_data['paragraph']['Heading 4'] = 'Heading 4';
    $spaw_dropdown_data['paragraph']['Heading 5'] = 'Heading 5';
    $spaw_dropdown_data['paragraph']['Heading 6'] = 'Heading 6';// image library related config// allowed extentions for uploaded image files
    $spaw_valid_imgs = array('gif', 'jpg', 'jpeg', 'png');// allow upload in image library
    $spaw_upload_allowed = true;// image libraries
    $spaw_imglibs = array(
      array(
        'value'   => "upload/public/images/",
        'text'    => '私人图片',
      ),
      array(
        'value'   => "upload/public/images_pub/",
        'text'    => '共享图片区',
      ),
    );
    ?>
      

  4.   

    的确!
    不过我检查了show方法所调用的代码,确实没有发现使spaw获得焦点的语句
      

  5.   

    Show() 与 getHtml() 的代码如下:================================================  function getHtml()
      {
        global $spaw_dir;
        global $spaw_wysiwyg_instCount;
        global $spaw_active_toolbar;
        
        
        $n = $this->control_name;
        // todo: make more customizable    $buf = '';
        if ($this->checkBrowser())
        {
          if ($spaw_wysiwyg_instCount == 1)
          {
            $this->getCssScript();
          }
          // theme based css file and javascript
          $buf.= '<script language="JavaScript" src="'.$spaw_dir.'lib/themes/'.$this->theme.'/js/toolbar.js.php"></script>';
          $buf.= '<link rel="stylesheet" type="text/css" href="'.$spaw_dir.'lib/themes/'.$this->theme.'/css/toolbar.css">';      $buf.= '<table border="0" cellspacing="0" cellpadding="0" width="'.$this->getWidth().'">';
          $buf.= '<tr>';      $buf .= '<td id="SPAW_'.$n.'_toolbar_top_design" class="SPAW_'.$this->theme.'_toolbar" colspan="3">';
          $buf.= $this->toolbars->get('top');
          $buf .= '</td>';      $buf .= '<td id="SPAW_'.$n.'_toolbar_top_html" class="SPAW_'.$this->theme.'_toolbar" colspan="3" style="display : none;">';
          $buf.= $this->toolbars->get('top','html');
          $buf .= '</td>';
          
          $buf .= '</tr>';      $buf.= '<tr>';      $buf.= '<td id="SPAW_'.$n.'_toolbar_left_design" valign="top" class="SPAW_'.$this->theme.'_toolbar" >';
          $buf.= $this->toolbars->get('left');
          $buf .= '</td>';      $buf.= '<td id="SPAW_'.$n.'_toolbar_left_html" valign="top" class="SPAW_'.$this->theme.'_toolbar" style="display : none;">';
          $buf.= $this->toolbars->get('left','html');
          $buf .= '</td>';
          
          $buf .= '<td align="left" valign="top" width="100%">';
          
          //$buf.= '<input type="hidden" id="'.$n.'" name="'.$n.'">';
          $buf.= '<textarea id="'.$n.'" name="'.$n.'" style="width:100%; height:'.$this->getHeight().'; display:none;" class="SPAW_'.$this->theme.'_editarea"></textarea>';
          $buf.= '<input type="hidden" id="SPAW_'.$n.'_editor_mode" name="SPAW_'.$n.'_editor_mode" value="design">';
          $buf.= '<input type="hidden" id="SPAW_'.$n.'_lang" value="'.$this->lang->lang.'">';
          $buf.= '<input type="hidden" id="SPAW_'.$n.'_theme" value="'.$this->theme.'">';
          $buf.= '<input type="hidden" id="SPAW_'.$n.'_borders" value="on">';     $buf.= '<iframe id="'.$n.'_rEdit" style="width:100%; height:'.$this->getHeight().'; direction:'.$this->lang->getDir().';" onLoad="SPAW_editorInit(\''.$n.'\',\''.htmlspecialchars($this->getCssStyleSheet()).'\',\''.$this->lang->getDir().'\');" class="SPAW_'.$this->theme.'_editarea" frameborder="no" style="direction : "></iframe><br>';
          
          $buf.= "\n<script language=\"javascript\">\n<!--\n";
          
          $tmpstr = str_replace("\r\n","\n",$this->getValue());
          $tmpstr = str_replace("\r","\n",$tmpstr);
          $content = explode("\n",$tmpstr);
          $plus = "";
          foreach ($content as $line)
          {
            $buf.="setTimeout('document.all.".$n.".value ".$plus."=\"".str_replace('"','&quot;',str_replace("'","\'",$line))."\";',0);\n";
            $plus = "+";
          }      $buf.="setTimeout('document.all.".$n.".value = document.all.".$n.".value.replace(/&quot;/g,\'\"\');',0);"."\n";//      $buf.='setTimeout("alert(document.all.'.$n.'.value);",0);'."\n";//      $buf.='setTimeout("'.$n.'_rEdit.document.body.innerHTML += document.all.'.$n.'.value;",0);'."\n";
          
    //  $buf.='setTimeout("SPAW_toggle_borders(\''.$n.'\',this[\''.$n.'_rEdit\'].document.body,null);",0);'."\n";      $buf.= '//--></script>';      $buf.= '</td>';
          
          $buf.= '<td id="SPAW_'.$n.'_toolbar_right_design" valign="top" class="SPAW_'.$this->theme.'_toolbar">';
          $buf.= $this->toolbars->get('right');
          $buf .= '</td>';      $buf.= '<td id="SPAW_'.$n.'_toolbar_right_html" valign="top" class="SPAW_'.$this->theme.'_toolbar" style="display : none;">';
          $buf.= $this->toolbars->get('right','html');
          $buf .= '</td>';
          
          $buf.= '</tr>';
          $buf.= '<tr><td class="SPAW_'.$this->theme.'_toolbar"></td>';      $buf .= '<td id="SPAW_'.$n.'_toolbar_bottom_design" class="SPAW_'.$this->theme.'_toolbar" width="100%">';
          $buf.= $this->toolbars->get('bottom');
          $buf .= '</td>';      $buf .= '<td id="SPAW_'.$n.'_toolbar_bottom_html" class="SPAW_'.$this->theme.'_toolbar" width="100%" style="display : none;">';
          $buf.= $this->toolbars->get('bottom','html');
          $buf .= '</td>';
          
          $buf .= '<td class="SPAW_'.$this->theme.'_toolbar"></td></tr>';
          $buf.= '</table>';
        }
        else
        {
          // show simple text area
         $buf = '<textarea cols="20" rows="5" name="'.$n.'" style="width:'.$this->getWidth().'; height:'.$this->getHeight().'">'.$this->getValue().'</textarea>';
        }
        return $buf;
      }  // outputs wysiwyg control
      function show()
      {
        echo $this->getHtml();
      }
      

  6.   

    TO: xuzuning(唠叨)我已将整个 SPAW 打包到: http://www.3asoft.com/spaw.zip能否帮我查一下原因?
      

  7.   

    能解释一下spaw是什么东东吗?
      

  8.   

    什么是spaw?
    spaw是一款html在线编辑器
    主要优点是:
    1、交互式表格处理
    2、代码清晰,易于扩展
    3、允许多个编辑器共存于一个页面
    4、可自定义样式