htmlarea 里面的内容全部选择和删除是调用那几个方法。还有就是中文字符怎么再前台就是“????”二〇〇九,显示成了“二????九”

解决方案 »

  1.   

    <script>
    function ss(){
        var obj=document.getElementById("tt");
        var rng=document.body.createTextRange();
        
        rng.moveToElementText( obj );
        rng.select();
    }
    function dd(){
        var obj=document.getElementById("tt");
        obj.value="";
    }
    </script>
    <textarea id="tt"></textarea>
    <input type=button value="select" onclick="ss();"/>
    <input type=button value="delete" onclick="dd();"/>
      

  2.   


    function ss(){
        var obj=document.getElementById("tt");
        obj.select();
    }
      

  3.   

    3楼,我用了。调不了哦,主要是textarea 被htmlarea重写了,不能取到对象哦。4楼,我想问的是htmlarea的方式哦。谢谢你们了。问题还带解决中哦。
      

  4.   


    <%@ page contentType="text/html;charset=gb2312"%>
    <%@ taglib uri="webwork" prefix="ww" %><html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>修改<ww:property value="infoTcategory.infoPname"/></title>
    <link href="../css/admin.css" rel="stylesheet" type="text/css">
    <script language='javascript' src='{WWWROOT}js/popcalendar/popcalendar.js'></script>
    <script type="text/javascript">
       _editor_url = "../htmlarea/";
       _editor_lang = "zh-cn";
    </script>
    <script type="text/javascript" src="../htmlarea/htmlarea.js"></script>
    <script type="text/javascript">
      var editor = null;
    function initEditor(){
      editor = new HTMLArea("info_content");
      editor.generate();
    }
    /*
    function window.onload(){
        initEditor();
        tick();
        }
    */
    </script>
    <script LANGUAGE="javascript"> function FirstFocus()
    {
        initEditor();
        tick();
    document.FrmAddLink.info_title.focus()
    }
    function FrmAddLink_onsubmit() 
    {
    if(document.FrmAddLink.info_title.value=="") {
    alert("对不起,请输入标题!")
    document.FrmAddLink.info_title.focus()
    return false
    } //else if (document.FrmAddLink.info_content.value=="") {
    // alert("请填入内容")
    // document.FrmAddLink.info_content.focus()
    // return false
    // }
    }
    function save(){
         if(document.getElementById("MyInfoTitle").value==""){
             alert("新闻要闻标题不能为空");
             document.getElementById("MyInfoTitle").focus();
             return false;
         }

    document.FrmAddLink.info_content.value=editor.getHTML();
    //alert(document.FrmAddLink.info_content.value);
    if(document.FrmAddLink.idContent.value==""){
    document.FrmAddLink.action="addInfoTcontent.action";
    document.FrmAddLink.submit();
    }else{
    document.FrmAddLink.action="modiInfoTcontent.action";
    document.FrmAddLink.submit();
    }
    //alert(document.FrmAddLink.idContent.value)
    }
    function picSflag()
    {
    if (document.FrmAddLink.ImgFlag.checked == true) {
    document.FrmAddLink.picfile.disabled=false;
    } else {
    document.FrmAddLink.picfile.disabled=true;
    document.FrmAddLink.ImgFile.value="";
    }
    }
    function test(){
    document.FrmAddLink.info_content.value=editor.getHTML();
    //var t=document.FrmAddLink.info_content.value;
    //alert(t);
    }

    function preview(){
    window.open('../admin/Preview.jsp')
    }

    function focustext(){

     var obj=document.getElementById("info_content");
         var rng=document.body.createTextRange();    
         rng.moveToElementText( obj );
         rng.select();



    }
    function seftext(){
    var obj=document.getElementById("info_content");
         obj.value="";
    }

    </script>
    </head>
    <body background="../images/admin/020.gif" onLoad="FirstFocus()">
    <form method="POST" action="" name="FrmAddLink" language="javascript" onsubmit=" FrmAddLink_onsubmit()"><table width="800" border=1 align="center" cellPadding="6" cellSpacing="0" borderColorLight="#5E9BF7" borderColorDark="#FFFFFF" bgcolor="#FFFFFF">
      <tr>
    <td bgcolor="#99CCFF" align="center" style="padding-top:6px;font-size:14px"><b>修改<ww:if test="infoTcategory.infoPid==8"><ww:property value='infoTcontent.infoTitle'/> </ww:if> <ww:else><ww:property value="infoTmiddle.infoMname"/></ww:else></b></td>
      </tr>
      <tr>
         <td bgcolor="#FFFFFF">
           <table border="0" width="100%">
              <tr> 
                <td align="right" style="padding-top:3px"><b><ww:if test="infoTcategory.infoPid==8"><ww:property value='infoTcontent.infoTitle'/> </ww:if> <ww:else><ww:property value="infoTmiddle.infoMname"/></ww:else>标题:</b></td>
                <td height="30"><input class="TextBorder" id="MyInfoTitle" name="infoTcontent.infoTitle" value="<ww:property value='infoTcontent.infoTitle'/>" size="80" maxlength="60"><font color="#FF0000">*</font></td>
              </tr>
     <!-- ENDIF {info_pid}=6 -->  
              
              <tr>
                <td align="right" valign="top" style="padding-top:3px"><b><ww:if test="infoTcategory.infoPid==8"><ww:property value='infoTcontent.infoTitle'/> </ww:if> <ww:else><ww:property value="infoTmiddle.infoMname"/></ww:else>内容:</b></td>
                <td height="30">
    <div><textarea id="info_content" name="info_Content" cols="80" rows="35"><ww:property value='infoTcontent.infoContent'/></textarea></div>
              </tr>       
              <tr>
                <td align="right" valign="top" style="padding-top:3px"><b>查询关键字:</b></td>
                <td height="30"><input class="TextBorder"  name="infoTcontent.infoSearchkey" value="<ww:property value='infoTcontent.infoSearchkey'/>" size="80" maxlength="60"></td>
              </tr> 
            </table>
           </td>
      </tr>
     <tr><td align="center" bgcolor="#eeeeee">
    <input type="button" value=" 确定 " name="CmdOk" class="button" onclick="save()">&nbsp;          
    <input type="reset" value=" 返回 " name="CmdCancel" class="button" onclick="javascript:history.go(-1)">
    <input type="button" value=" 预览 " name="CmdCance2" class="button" onclick="preview()">
    <input type="button" value=" 全选2 " name="CmdCance4" class="button" onclick="focustext()" >
    <input type="button" value=" 全选3 " name="CmdCance5" class="button" onclick="seftext()" > </td>
      </tr>
    </table>
    </form>
    </body>
    </html>