2010-07-06 4 views

답변

0

Htmlbox은 html 요소 텍스트 영역을 확장하는 플러그인입니다. 일반적인 textarea html 요소처럼 취급 할 수 있습니다. 예를 들어 ..

$(function() 
{ 
$('#textboxid').htmlbox({ 
     toolbars:[ 
      [ 
      "separator","bold","italic","underline","strike","sup","sub", 
      "separator","removeformat" 
      ], 
      ["separator","fontsize","fontfamily","fontcolor","highlight"] 
     ], 
     skin:"blue" 
     }); 
alert($('#textboxid').val()); 
} 
+0

HTMLbox에서 자바 스크립트 삽입을 어떻게 처리합니까? – user384080

+0

지금이 답변에 ?? 누군가?? – user384080

0

HtmlBox에 내장 된 기능을 사용하려면 다음을 수행하십시오 는 예를 들어 hb_full.get_html() (즉, 변수를 사용하여 HtmlBox의 메소드를 호출 한 다음 변수에 htmlbox()의 반환을 할당하고, 또는 다른 방법). 아래 코드 예제를 참조하십시오.

<script type="text/javascript"> 
    var hb_full; 
$(document).ready(function(){ 
     hb_full = $("#htmlbox_full").css("height", "300").css("width", "100%").htmlbox({ 
      toolbars: [ 
       [ 
        // Cut, Copy, Paste 
        "separator", "cut", "copy", "paste", 
        // Undo, Redo 
        "separator", "undo", "redo", 
        // Bold, Italic, Underline, Strikethrough, Sup, Sub 
        "separator", "bold", "italic", "underline", "strike", "sup", "sub", 
        // Left, Right, Center, Justify 
        "separator", "justify", "left", "center", "right", 
        // Ordered List, Unordered List, Indent, Outdent 
        "separator", "ol", "ul", "indent", "outdent", 
        // Hyperlink, Remove Hyperlink, Image 
        "separator", "link", "unlink", "image" 
       ], 
       [ 
        // Show code 
        "separator", "code", 
          // Formats, Font size, Font family, Font color, Font, Background 
        "separator", "formats", "fontsize", "fontfamily", 
        "separator", "fontcolor", "highlight", 
       ], 
       [ 
        //Strip tags 
        "separator", "removeformat", "striptags", "hr", "paragraph", 
        // Styles, Source code syntax buttons 
        "separator", "quote", "styles", "syntax" 
       ] 
      ], 
      about: true, // "false" to hide About button 
      idir: "./img/HtmlBoxImg/", 
      icons: "default", //all options: "default", "silk" 
      skin: "blue"  //all options: "silver", "blue", "green", "red" 
     }); 
    }); 

    function getHtmlFromEditor() 
    { 
     var HtmlFromEditor = hb_full.get_html(); 
     alert(HtmlFromEditor); 
    } 
    </script> 

    <textarea id="htmlbox_full"></textarea> 
<button onclick="getHtmlFromEditor();">Display HTML</button>