Inserting HTML in JEditorPane

Extremely frustrating trying to work with the HTML editing model (JEditorPane - content type text/html). I am using 1.4.2_06. Tying some basic actions to buttons or keystrokes is no problem (eg bold, italic etc.) but the most NB things like being able to drop a <br> in where the user presses enter doesn't seem possible. Has anyone found a way to drop in HTML at the caret? Would hugely appreciate any ideas.
Matthew

Ok, figured it out myself:
        notesArea.getInputMap().put(KeyStroke.getKeyStroke("enter"), "enterAction");
        notesArea.getActionMap().put("enterAction", new HTMLEditorKit.InsertHTMLTextAction("InsertBR", "<br>", null, HTML.Tag.IMPLIED, null, null));

Similar Messages

  • Inserting HTML into JEditorPane

    I have a window with a JEditorPane on top and a JTextField below it. I need to be able to type raw HTML into the edit field and have it appended to the HTML document displayed above.
    For example if I type...
    This is <b>bold
    I need to append that to the document. However I want the style to stick. Notice I did not close the tag above. I want the next line I enter into the edit field...
    and so is this but not</b> this.
    I want this to appear bold up until the closing tag and then return to normal. The problem is that every time I append new text to the document the style is restored to normal.
    I insert the text with the following code. I send the contents of the JTextField to the following function when I hit return.
    void processInput(String input) {
    try {
    HTMLDocument doc = (HTMLDocument) output.getDocument(); // output is my JEditorPane
    editor.insertHTML(doc, doc.getLength(), input, 0, 0, HTML.Tag.BODY); // editor is HTMLEditorKit
    // relevant catch clauses
    Basically I want the two broken input sequences to appear in the editor as one seamless entry. I want to be able to type these two entries and have them show up as if they were entered as one entry.
    entry 1:This is <b>bold
    entry 2: and so is this but not</b> this.
    I want to somehow cause this to be displayed as if I typed...
    This is <b>bold and so is this but not</b> this.
    Is there a way I can do this?
    Thanks.
    -Russ

    as i understand you you want to write
    entry 1:This is <b>bold
    entry 2: and so is this but not</b> this.
    in two lines
    Try this
    entry 1:This is <b>bold<br>
    entry 2: and so is this but not</b> this.

  • Insert html into styled document

    Hi,
    I would like to insert html content into a JEditorPane that uses a StyledDocument and DefaultStyledEditorKit. I do not want to use the HtmlEditorKit for some reasons though that might change later. Now, I want to insert ElementSpec objects into my styled document and the only way seems to be doc.insert(o, espec) where espec is of type ElementSpec[]. I would like to insert my ElementSpecs one by one if possible.
    Can someone tell me how I can do this.
    Cheers,
    Omprakash.V

    Hi,
    I was referring to DefaultEditorKit in the above post when I said DefaultStyledEditorKit.
    Cheers,
    Omprakash.V

  • Problem to display Animated Gif from HTML into JEditorPane

    I have a problem displaying animated gif that comes from URL (HTML) into JEditorPane.
    Let me show you the source I have:
    * @author Dobromir Gospodinov
    * @version 1.0
    * Date: Dec 6, 2002
    * Time: 6:47:53 PM
    package test.advertserver;
    import javax.swing.*;
    import java.awt.*;
    import java.io.IOException;
    public class Test {
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              JEditorPane ed = new JEditorPane();
              try {
                   ed.setPage("http://localhost:8200/servlet?key=value");
              } catch (IOException e) {
                   e.printStackTrace();
              JPanel panel = new JPanel();
              panel.setPreferredSize(new Dimension(500, 500));
              panel.add(ed);
              frame.getContentPane().add(panel);
              frame.pack();
              frame.setVisible(true);
    }Part of the returned from servlet HTML includes an img tag:
    <img src="/images/MyAnimatedGif.gif" alt="animated gif comment" width="480" height="50"  border="0">Let us assume that MyAnimatedGif.gif has 10 frames and gif is looped - when the 10th is dipslayed it has to display the 1st and so on.
    JEditorPane displays frames from 1 to 10 correctly but does not start from the first again. Instead JEditorPane displays a broken image.
    I locate where the problem arise:
    JEditorPane has an HTMLEditorKit that creates javax.swing.text.html.ImageView instance for every IMG tag.
    And here is the problem:
    ImageView has an ImageObserver necessary for the asynchronous image download. ImageObserver has the imageUpdate method. But this imageUpdate method is never called with ALLBITS flag raised up. Instead, after the last frame of MyAnimatedGif.gif is downloaded the imageUpdate method is called with flag ERROR raised up. Obviously this is a bug of Sun's implementation. Finaly the flag ALLBITS has to be received for normal end of image observing. But ALLBITS flag does not come.
    So, can anybody help me how to load an animated gif within JEditorPane completely.
    Thank You in advance,
    Dobromir Gospodinov
    P.S. If somebody of you wants to debbug what happens within ImageView will have to implement it (and related classes too, because of the limited package visability) borrowing the source from Sun's ImageView.

    I'm also having this problem with java 1.4.1 I discovered that some animated gifs work fine, while others stop animating. Running with java 1.3.1 fixed the problem. I'm going to report this as a bug
    Here's my code:
    import java.awt.*;
    import java.io.*;
    import javax.swing.*;
    public class AnimatedGifTester
    extends JFrame
    public static void main(String argv[])
    throws Exception
    new AnimatedGifTester();
    public AnimatedGifTester()
    throws Exception
    String[] images = new String[] {
    "http://www.gif.com/ImageGallery/Animated/Animals/Photographic/dog_running.gif",
    "http://www.gif.com/ImageGallery/Animated/Characters/Cartoon/java.gif",
    "http://www.webdeveloper.com/animations/bnifiles/anielg.gif",
    "http://www.webdeveloper.com/animations/bnifiles/cat2.gif",
    "http://images.animfactory.com/animations/animals/fish/big_fish_swimming_md_wht.gif",
    "http://www.webgenies.co.uk/images/martian.gif",
    "http://www.webdeveloper.com/animations/bnifiles/at_sign_rotating.gif",
    "http://www.webdeveloper.com/animations/bnifiles/arrow_1.gif",
    "http://www.gif.com/ImageGallery/Animated/Characters/Cartoon/javaacro.gif",
    "http://java.sun.com/products/java-media/2D/samples/suite/Image/duke.running.gif",
    "http://www.gif.com/ImageGallery/Animated/SouthPark/Cartoon/stan.gif"
    StringBuffer buffer = new StringBuffer("<html><body>");
    for (int idx = 0; idx < images.length; idx++)
    buffer.append("<img src='" + images[idx] + "'>");
    buffer.append("</body></html>");
    String html = buffer.toString();
    // save a copy of the html to open in a browser so we can see what it's
    // supposed to look like
    BufferedWriter writer = new BufferedWriter(new FileWriter("animatedGifTest.html"));
    writer.write(html);
    writer.close();
    JEditorPane editorPane = new JEditorPane("text/html", html);
    editorPane.setEditable(false);
    getContentPane().add(editorPane);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(new Dimension(400, 600));
    show();

  • Inserting HTML into a table?

    I am trying to find an easier method of inserting html code into a column of type varchar2. I have to insert 100's of lines of html into a table weekly and the inserts keep failing because of special charecters within the html code itself. I have written scripts using UTL_FILE functions but this is very tedious to do weekly. Is there a better method to accomplish inserting html?

    try this.
    Hi,
    procedure start_import (p_filename in varchar2)
    is
    v_lob clob;
    v_offset number := 1;
    v_file bfile := bfilename('IMPORT',p_filename);
    v_lob_length number;
    begin
    -- File open
    dbms_lob.fileopen(v_file);
    -- get file length
    v_lob_length := dbms_lob.getlength(v_file);
    -- Create temp LOB (CACHED)
    dbms_lob.createtemporary(v_lob,TRUE);
    -- fill Temp Lob with filecontent
    dbms_lob.loadfromfile(v_lob,v_file,v_lob_length);
    -- Close file
    dbms_lob.fileclose(v_file);
    So, now you have the Filecontent in your temp LOB.
    For more info. about LOB, read Oracle Documentation.
    Hope this helps,
    Kalpen
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Troy Johnson ([email protected]):
    I am trying to find an easier method of inserting html code into a column of type varchar2. I have to insert 100's of lines of html into a table weekly and the inserts keep failing because of special charecters within the html code itself. I have written scripts using UTL_FILE functions but this is very tedious to do weekly. Is there a better method to accomplish inserting html?<HR></BLOCKQUOTE>
    null

  • Inserting HTML/CSS in a Tabbed Panel

    I've been having trouble inserting HTML/CSS into a Tabbed Panel widget. In this case, the HTML/CSS is creating a text box with scroll bars (as described in an excellent workaround for getting scroll bars to work).
    Has anyone else come across this situation?
    Thanks!

    I'm not seeing the same problem (the scrolling text box displays fine in the tabbed panel for me).
    Does your HTML container fit within the content area of the panel?
    Here are screenshots from Muse Design view:
    and Preview in Browser (Firefox):
    When you say it's not working, what exactly do you mean? What's happening?
    Best regards,
    Corey
    Edited: Adding topic on creating scrolling text box for reference: http://forums.adobe.com/message/4327943#4327943)

  • Inserting html into a composition in muse

    Hi, I am trying to insert some html into a composition in Muse.  I would like to have a clickable button trigger, and then a kind of overlay opens up with an interactive calculator inside.  I have the html for the calculator, the problem is no matter how I try to insert it into Muse, the calculator either disappears (as well as the trigger) for some reason, or the calculator stays on the page the entire time, losing the whole clickable effect.
    Can someone tell me the best way to do this?

    Hello,
    Which Composition are you trying to Use ? Blank,Featured News, Lightbox Display, Presentation or Tooltip ?
    Also Make Sure to drag and drop the inserted HTML window over the target (Border of target gets activated once you move it over), Hopefully this will work.
    I created the same using Tooltip composition and its working fine. Please take a look at the link.
    Home
    If it do not work then please share the calculator HTML  code that you are inserting so that I can do some test at my end.
    Regards
    Vivek

  • How to insert HTML content in a IVIEW

    Hi,
    How to insert HTML content in a iview any body help me with the solution.
    Thanks & Regards
       kiran.B

    Hi,
    You can just spit out HTML in the request object:
    request.write("<B>Whatever</B>");
    Or if you have a single HTML page, you might want to just add it to KM and create an iView from it.
    Hope this helps.
    Daniel

  • Insert html

    I am creating a mobile application in indesign and then using DPS...wondering how i can insert the following html...they are learning activities that we created using a seperate application (Hot Potatoes)...i have succesfully integrated them into applications using Dreamweaver and Phonegap but indesign and DPS appears to be the direction that this is moving.  When i try and insert the code into the "insert html" function it doesn't all fit so I am wondering if there is any way to work around this...
    not sure if this is better for the indesign forum or the DPS forum...the code for the activities is below...thanks
    <?xml version="1.0"?>
           <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
           <html xmlns="http://www.w3.org/1999/xhtml"
                 xml:lang="en"><head>
    <meta name="author" content="Created with Hot Potatoes by Half-Baked Software, registered to Tim Fanning."></meta>
    <meta name="keywords" content="Hot Potatoes, Hot Potatoes, Half-Baked Software, Java, University of Victoria"></meta>
    <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>
    Acura NSX Commercial
    </title>
    <!-- Made with executable version Java Hot Potatoes 6.1.0.5 -->
    <!-- The following insertion allows you to add your own code directly to this head tag from the configuration screen -->
    <style type="text/css">
    /* This is the CSS stylesheet used in the exercise. */
    /* Elements in square brackets are replaced by data based on configuration settings when the exercise is built. */
    /* BeginCorePageCSS */
    /* Made with executable version Java Hot Potatoes 6.1.0.5 */
    /* Hack to hide a nested Quicktime player from IE, which can't handle it. */
    * html object.MediaPlayerNotForIE {
              display: none;
    body{
              font-family: gill sans, heletevica;
              background-color: #ffffff;
              color: #000000;
              margin-right: 5%;
              margin-left: 5%;
              font-size: 14;
    p{
              text-align: left;
              margin: 0px;
              font-size: 100%;
    table,div,span,td{
              font-size: 100%;
              color: #000000;
    div.Titles{
              padding: 0.5em;;
              text-align: center;
              color: #009900;
    button{
              font-family: gill sans, heletevica;
              font-size: 100%;
              display: inline;
    .ExerciseTitle{
              font-size: 140%;
              color: #009900;
    .ExerciseSubtitle{
              font-size: 120%;
              color: #009900;
    div.StdDiv{
              background-color: #ffffff;
              text-align: center;
              font-size: 100%;
              color: #000000;
              padding: 0.5em;
              border-style: solid;
              border-width: 1px 1px 1px 1px;
              border-color: #000000;
              margin-bottom: 1px;
    /* EndCorePageCSS */
    .RTLText{
              text-align: right;
              font-size: 150%;
              direction: rtl;
              font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", gill sans, heletevica;
    .CentredRTLText{
              text-align: center;
              font-size: 150%;
              direction: rtl;
              font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", gill sans, heletevica;
    button p.RTLText{
              text-align: center;
    .RTLGapBox{
              text-align: right;
              font-size: 150%;
              direction: rtl;
              font-family: "Times New Roman", gill sans, heletevica;
    .Guess{
              font-weight: bold;
    .CorrectAnswer{
              font-weight: bold;
    div#Timer{
              padding: 0.25em;
              margin-left: auto;
              margin-right: auto;
              text-align: center;
              color: #009900;
    span#TimerText{
              padding: 0.25em;
              border-width: 1px;
              border-style: solid;
              font-weight: bold;
              display: none;
              color: #009900;
    span.Instructions{
    div.ExerciseText{
    .FeedbackText, .FeedbackText span.CorrectAnswer, .FeedbackText span.Guess, .FeedbackText span.Answer{
              color: #009900;
    .LeftItem{
              font-size: 100%;
              color: #000000;
              text-align: left;
    .RightItem{
              font-weight: bold;
              font-size: 100%;
              color: #000000;
    span.CorrectMark{
    input, textarea{
              font-family: gill sans, heletevica;
              font-size: 120%;
    select{
              font-size: 100%;
    div.Feedback {
              background-color: #ffffff;
              left: 33%;
              width: 34%;
              top: 33%;
              z-index: 1;
              border-style: solid;
              border-width: 1px;
              padding: 5px;
              text-align: center;
              color: #009900;
              position: absolute;
              display: none;
              font-size: 100%;
    div.ExerciseDiv{
              color: #000000;
    /* JMatch flashcard styles */
    table.FlashcardTable{
              background-color: transparent;
              color: #000000;
              border-color: #000000;
              margin-left: 5%;
              margin-right: 5%;
              margin-top: 2em;
              margin-bottom: 2em;
              width: 90%;
              position: relative;
              text-align: center;
              padding: 0px;
    table.FlashcardTable tr{
              border-style: none;
              margin: 0px;
              padding: 0px;
              background-color: #ffffff;
    table.FlashcardTable td.Showing{
              font-size: 140%;
              text-align: center;
              width: 50%;
              display: table-cell;
              padding: 2em;
              margin: 0px;
              border-style: solid;
              border-width: 1px;
              color: #000000;
              background-color: #ffffff;
    table.FlashcardTable td.Hidden{
              display: none;
    /* JMix styles */
    div#SegmentDiv{
              margin-top: 2em;
              margin-bottom: 2em;
              text-align: center;
    a.ExSegment{
              font-size: 120%;
              font-weight: bold;
              text-decoration: none;
              color: #000000;
    span.RemainingWordList{
              font-style: italic;
    div.DropLine {
              position: absolute;
              text-align: center;
              border-bottom-style: solid;
              border-bottom-width: 1px;
              border-bottom-color: #009900;
              width: 80%;
    /* JCloze styles */
    .ClozeWordList{
              text-align: center;
              font-weight: bold;
    div.ClozeBody{
              text-align: left;
              margin-top: 2em;
              margin-bottom: 2em;
              line-height: 2.0
    span.GapSpan{
              font-weight: bold;
    /* JCross styles */
    table.CrosswordGrid{
              margin: auto auto 1em auto;
              border-collapse: collapse;
              padding: 0px;
              background-color: #000000;
    table.CrosswordGrid tbody tr td{
              width: 1.5em;
              height: 1.5em;
              text-align: center;
              vertical-align: middle;
              font-size: 140%;
              padding: 1px;
              margin: 0px;
              border-style: solid;
              border-width: 1px;
              border-color: #000000;
              color: #000000;
    table.CrosswordGrid span{
              color: #000000;
    table.CrosswordGrid td.BlankCell{
              background-color: #000000;
              color: #000000;
    table.CrosswordGrid td.LetterOnlyCell{
              text-align: center;
              vertical-align: middle;
              background-color: #ffffff;
              color: #000000;
              font-weight: bold;
    table.CrosswordGrid td.NumLetterCell{
              text-align: left;
              vertical-align: top;
              background-color: #ffffff;
              color: #000000;
              padding: 1px;
              font-weight: bold;
    .NumLetterCellText{
              cursor: pointer;
              color: #000000;
    .GridNum{
              vertical-align: super;
              font-size: 66%;
              font-weight: bold;
              text-decoration: none;
              color: #000000;
    .GridNum:hover, .GridNum:visited{
              color: #000000;
    table#Clues{
              margin: auto;
              vertical-align: top;
    table#Clues td{
              vertical-align: top;
    table.ClueList{
      margin: auto;
    td.ClueNum{
              text-align: right;
              font-weight: bold;
              vertical-align: top;
    td.Clue{
              text-align: left;
    div#ClueEntry{
              text-align: left;
              margin-bottom: 1em;
    /* Keypad styles */
    div.Keypad{
              text-align: center;
              display: none; /* initially hidden, shown if needed */
              margin-bottom: 0.5em;
    div.Keypad button{
              font-family: gill sans, heletevica;
              font-size: 120%;
              background-color: #ffffff;
              color: #000000;
              width: 2em;
    /* JQuiz styles */
    div.QuestionNavigation{
              text-align: center;
    .QNum{
              margin: 0em 1em 0.5em 1em;
              font-weight: bold;
              vertical-align: middle;
    textarea{
              font-family: gill sans, heletevica;
    .QuestionText{
              text-align: left;
              margin: 0px;
              font-size: 100%;
    .Answer{
              font-size: 120%;
              letter-spacing: 0.1em;
    .PartialAnswer{
              font-size: 120%;
              letter-spacing: 0.1em;
              color: #009900;
    .Highlight{
              color: #000000;
              background-color: #ffff00;
              font-weight: bold;
              font-size: 120%;
    ol.QuizQuestions{
              text-align: left;
              list-style-type: none;
    li.QuizQuestion{
              padding: 1em;
              border-style: solid;
              border-width: 0px 0px 1px 0px;
    ol.MCAnswers{
              text-align: left;
              list-style-type: upper-alpha;
              padding: 1em;
    ol.MCAnswers li{
              margin-bottom: 1em;
    ol.MSelAnswers{
              text-align: left;
              list-style-type: lower-alpha;
              padding: 1em;
    div.ShortAnswer{
              padding: 1em;
    .FuncButton {
              text-align: center;
              border-style: solid;
              border-left-color: #ffffff;
              border-top-color: #ffffff;
              border-right-color: #7f7f7f;
              border-bottom-color: #7f7f7f;
              color: #000000;
              background-color: #ffffff;
              border-width: 2px;
              padding: 3px 6px 3px 6px;
              cursor: pointer;
    .FuncButtonUp {
              color: #ffffff;
              text-align: center;
              border-style: solid;
              border-left-color: #ffffff;
              border-top-color: #ffffff;
              border-right-color: #7f7f7f;
              border-bottom-color: #7f7f7f;
              background-color: #000000;
              color: #ffffff;
              border-width: 2px;
              padding: 3px 6px 3px 6px;
              cursor: pointer;
    .FuncButtonDown {
              color: #ffffff;
              text-align: center;
              border-style: solid;
              border-left-color: #7f7f7f;
              border-top-color: #7f7f7f;
              border-right-color: #ffffff;
              border-bottom-color: #ffffff;
              background-color: #000000;
              color: #ffffff;
              border-width: 2px;
              padding: 3px 6px 3px 6px;
              cursor: pointer;
    /*BeginNavBarStyle*/
    div.NavButtonBar{
              background-color: #ffffff;
              text-align: center;
              margin: 2px 0px 2px 0px;
              clear: both;
              font-size: 100%;
    .NavButton {
              border-style: solid;
              border-left-color: #ffffff;
              border-top-color: #ffffff;
              border-right-color: #7f7f7f;
              border-bottom-color: #7f7f7f;
              background-color: #ffffff;
              color: #000000;
              border-width: 2px;
              cursor: pointer;
    .NavButtonUp {
              border-style: solid;
              border-left-color: #ffffff;
              border-top-color: #ffffff;
              border-right-color: #7f7f7f;
              border-bottom-color: #7f7f7f;
              color: #ffffff;
              background-color: #000000;
              border-width: 2px;
              cursor: pointer;
    .NavButtonDown {
              border-style: solid;
              border-left-color: #7f7f7f;
              border-top-color: #7f7f7f;
              border-right-color: #ffffff;
              border-bottom-color: #ffffff;
              color: #ffffff;
              background-color: #000000;
              border-width: 2px;
              cursor: pointer;
    /*EndNavBarStyle*/
    a{
              color: #009900;
    a:visited{
              color: #009900;
    a:hover{
              color: #009900;
    div.CardStyle {
              position: absolute;
              font-family: gill sans, heletevica;
              font-size: 100%;
              padding: 5px;
              border-style: solid;
              border-width: 1px;
              color: #000000;
              background-color: #ffffff;
              left: -50px;
              top: -50px;
              overflow: visible;
    .rtl{
              text-align: right;
              font-size: 140%;
    </style>
    <script type="text/javascript">
    //<![CDATA[
    <!--
    function Client(){
    //if not a DOM browser, hopeless
              this.min = false; if (document.getElementById){this.min = true;};
              this.ua = navigator.userAgent;
              this.name = navigator.appName;
              this.ver = navigator.appVersion; 
    //Get data about the browser
              this.mac = (this.ver.indexOf('Mac') != -1);
              this.win = (this.ver.indexOf('Windows') != -1);
    //Look for Gecko
              this.gecko = (this.ua.indexOf('Gecko') > 1);
              if (this.gecko){
                        this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length));
                        if (this.geckoVer < 20020000){this.min = false;}
    //Look for Firebird
              this.firebird = (this.ua.indexOf('Firebird') > 1);
    //Look for Safari
              this.safari = (this.ua.indexOf('Safari') > 1);
              if (this.safari){
                        this.gecko = false;
    //Look for IE
              this.ie = (this.ua.indexOf('MSIE') > 0);
              if (this.ie){
                        this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length));
                        if (this.ieVer < 5.5){this.min = false;}
    //Look for Opera
              this.opera = (this.ua.indexOf('Opera') > 0);
              if (this.opera){
                        this.operaVer = parseFloat(this.ua.substring(this.ua.indexOf('Opera')+6, this.ua.length));
                        if (this.operaVer < 7.04){this.min = false;}
              if (this.min == false){
                        alert('Your browser may not be able to handle this page.');
    //Special case for the horrible ie5mac
              this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6));
    var C = new Client();
    //for (prop in C){
    //          alert(prop + ': ' + C[prop]);
    //CODE FOR HANDLING NAV BUTTONS AND FUNCTION BUTTONS
    //[strNavBarJS]
    function NavBtnOver(Btn){
              if (Btn.className != 'NavButtonDown'){Btn.className = 'NavButtonUp';}
    function NavBtnOut(Btn){
              Btn.className = 'NavButton';
    function NavBtnDown(Btn){
              Btn.className = 'NavButtonDown';
    //[/strNavBarJS]
    function FuncBtnOver(Btn){
              if (Btn.className != 'FuncButtonDown'){Btn.className = 'FuncButtonUp';}
    function FuncBtnOut(Btn){
              Btn.className = 'FuncButton';
    function FuncBtnDown(Btn){
              Btn.className = 'FuncButtonDown';
    function FocusAButton(){
              if (document.getElementById('CheckButton1') != null){
                        document.getElementById('CheckButton1').focus();
              else{
                        if (document.getElementById('CheckButton2') != null){
                                  document.getElementById('CheckButton2').focus();
                        else{
                                  document.getElementsByTagName('button')[0].focus();
    //CODE FOR HANDLING DISPLAY OF POPUP FEEDBACK BOX
    var topZ = 1000;
    function ShowMessage(Feedback){
              var Output = Feedback + '<br /><br />';
              document.getElementById('FeedbackContent').innerHTML = Output;
              var FDiv = document.getElementById('FeedbackDiv');
              topZ++;
              FDiv.style.zIndex = topZ;
              FDiv.style.top = TopSettingWithScrollOffset(30) + 'px';
              FDiv.style.display = 'block';
              ShowElements(false, 'input');
              ShowElements(false, 'select');
              ShowElements(false, 'object');
              ShowElements(true, 'object', 'FeedbackContent');
    //Focus the OK button
              setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
    function ShowElements(Show, TagName, ContainerToReverse){
    // added third argument to allow objects in the feedback box to appear
    //IE bug -- hide all the form elements that will show through the popup
    //FF on Mac bug : doesn't redisplay objects whose visibility is set to visible
    //unless the object's display property is changed
              //get container object (by Id passed in, or use document otherwise)
              TopNode = document.getElementById(ContainerToReverse);
              var Els;
              if (TopNode != null) {
                        Els = TopNode.getElementsByTagName(TagName);
              } else {
                        Els = document.getElementsByTagName(TagName);
              for (var i=0; i<Els.length; i++){
                        if (TagName == "object") {
                                  //manipulate object elements in all browsers
                                  if (Show == true){
                                            Els[i].style.visibility = 'visible';
                                            //get Mac FireFox to manipulate display, to force screen redraw
                                            if (C.mac && C.gecko) {Els[i].style.display = '';}
                                  else{
                                            Els[i].style.visibility = 'hidden';
                                            if (C.mac && C.gecko) {Els[i].style.display = 'none';}
                        else {
                                  // tagName is either input or select (that is, Form Elements)
                                  // ie6 has a problem with Form elements, so manipulate those
                                  if (C.ie) {
                                            if (C.ieVer < 7) {
                                                      if (Show == true){
                                                                Els[i].style.visibility = 'visible';
                                                      else{
                                                                Els[i].style.visibility = 'hidden';
    function HideFeedback(){
              document.getElementById('FeedbackDiv').style.display = 'none';
              ShowElements(true, 'input');
              ShowElements(true, 'select');
              ShowElements(true, 'object');
              if (Finished == true){
                        Finish();
    //GENERAL UTILITY FUNCTIONS AND VARIABLES
    //PAGE DIMENSION FUNCTIONS
    function PageDim(){
    //Get the page width and height
              this.W = 600;
              this.H = 400;
              this.W = document.getElementsByTagName('body')[0].clientWidth;
              this.H = document.getElementsByTagName('body')[0].clientHeight;
    var pg = null;
    function GetPageXY(El) {
              var XY = {x: 0, y: 0};
              while(El){
                        XY.x += El.offsetLeft;
                        XY.y += El.offsetTop;
                        El = El.offsetParent;
              return XY;
    function GetScrollTop(){
              if (typeof(window.pageYOffset) == 'number'){
                        return window.pageYOffset;
              else{
                        if ((document.body)&&(document.body.scrollTop)){
                                  return document.body.scrollTop;
                        else{
                                  if ((document.documentElement)&&(document.documentElement.scrollTop)){
                                            return document.documentElement.scrollTop;
                                  else{
                                            return 0;
    function GetViewportHeight(){
              if (typeof window.innerHeight != 'undefined'){
                        return window.innerHeight;
              else{
                        if (((typeof document.documentElement != 'undefined')&&(typeof document.documentElement.clientHeight !=
         'undefined'))&&(document.documentElement.clientHeight != 0)){
                                  return document.documentElement.clientHeight;
                        else{
                                  return document.getElementsByTagName('body')[0].clientHeight;
    function TopSettingWithScrollOffset(TopPercent){
              var T = Math.floor(GetViewportHeight() * (TopPercent/100));
              return GetScrollTop() + T;
    //CODE FOR AVOIDING LOSS OF DATA WHEN BACKSPACE KEY INVOKES history.back()
    var InTextBox = false;
    function SuppressBackspace(e){
              if (InTextBox == true){return;}
              if (C.ie) {
                        thisKey = window.event.keyCode;
              else {
                        thisKey = e.keyCode;
              var Suppress = false;
              if (thisKey == 8) {
                        Suppress = true;
              if (Suppress == true){
                        if (C.ie){
                                  window.event.returnValue = false;
                                  window.event.cancelBubble = true;
                        else{
                                  e.preventDefault();
    if (C.ie){
              document.attachEvent('onkeydown',SuppressBackspace);
              window.attachEvent('onkeydown',SuppressBackspace);
    else{
              if (window.addEventListener){
                        window.addEventListener('keypress',SuppressBackspace,false);
    function ReduceItems(InArray, ReduceToSize){
              var ItemToDump=0;
              var j=0;
              while (InArray.length > ReduceToSize){
                        ItemToDump = Math.floor(InArray.length*Math.random());
                        InArray.splice(ItemToDump, 1);
    function Shuffle(InArray){
              var Num;
              var Temp = new Array();
              var Len = InArray.length;
              var j = Len;
              for (var i=0; i<Len; i++){
                        Temp[i] = InArray[i];
              for (i=0; i<Len; i++){
                        Num = Math.floor(j  *  Math.random());
                        InArray[i] = Temp[Num];
                        for (var k=Num; k < (j-1); k++) {
                                  Temp[k] = Temp[k+1];
                        j--;
              return InArray;
    function WriteToInstructions(Feedback) {
              document.getElementById('InstructionsDiv').innerHTML = Feedback;
    function EscapeDoubleQuotes(InString){
              return InString.replace(/"/g, '&quot;')
    function TrimString(InString){
            var x = 0;
            if (InString.length != 0) {
                    while ((InString.charAt(InString.length - 1) == '\u0020') || (InString.charAt(InString.length - 1) == '\u000A') || (InString.charAt(InString.length - 1) == '\u000D')){
                            InString = InString.substring(0, InString.length - 1)
                    while ((InString.charAt(0) == '\u0020') || (InString.charAt(0) == '\u000A') || (InString.charAt(0) == '\u000D')){
                            InString = InString.substring(1, InString.length)
                    while (InString.indexOf('  ') != -1) {
                            x = InString.indexOf('  ')
                            InString = InString.substring(0, x) + InString.substring(x+1, InString.length)
                    return InString;
            else {
                    return '';
    function FindLongest(InArray){
              if (InArray.length < 1){return -1;}
              var Longest = 0;
              for (var i=1; i<InArray.length; i++){
                        if (InArray[i].length > InArray[Longest].length){
                                  Longest = i;
              return Longest;
    //UNICODE CHARACTER FUNCTIONS
    function IsCombiningDiacritic(CharNum){
              var Result = (((CharNum >= 0x0300)&&(CharNum <= 0x370))||((CharNum >= 0x20d0)&&(CharNum <= 0x20ff)));
              Result = Result || (((CharNum >= 0x3099)&&(CharNum <= 0x309a))||((CharNum >= 0xfe20)&&(CharNum <= 0xfe23)));
              return Result;
    function IsCJK(CharNum){
              return ((CharNum >= 0x3000)&&(CharNum < 0xd800));
    //SETUP FUNCTIONS
    //BROWSER WILL REFILL TEXT BOXES FROM CACHE IF NOT PREVENTED
    function ClearTextBoxes(){
              var NList = document.getElementsByTagName('input');
              for (var i=0; i<NList.length; i++){
                        if ((NList[i].id.indexOf('Guess') > -1)||(NList[i].id.indexOf('Gap') > -1)){
                                  NList[i].value = '';
                        if (NList[i].id.indexOf('Chk') > -1){
                                  NList[i].checked = '';
    //EXTENSION TO ARRAY OBJECT
    function Array_IndexOf(Input){
              var Result = -1;
              for (var i=0; i<this.length; i++){
                        if (this[i] == Input){
                                  Result = i;
              return Result;
    Array.prototype.indexOf = Array_IndexOf;
    //IE HAS RENDERING BUG WITH BOTTOM NAVBAR
    function RemoveBottomNavBarForIE(){
              if ((C.ie)&&(document.getElementById('Reading') != null)){
                        if (document.getElementById('BottomNavBar') != null){
                                  document.getElementById('TheBody').removeChild(document.getElementById('Bo ttomNavBar'));
    //HOTPOTNET-RELATED CODE
    var HPNStartTime = (new Date()).getTime();
    var SubmissionTimeout = 30000;
    var Detail = ''; //Global that is used to submit tracking data
    function Finish(){
    //If there's a form, fill it out and submit it
              if (document.store != null){
                        Frm = document.store;
                        Frm.starttime.value = HPNStartTime;
                        Frm.endtime.value = (new Date()).getTime();
                        Frm.mark.value = Score;
                        Frm.detail.value = Detail;
                        Frm.submit();
    //JQUIZ CORE JAVASCRIPT CODE
    var CurrQNum = 0;
    var CorrectIndicator = ':-)';
    var IncorrectIndicator = 'X';
    var YourScoreIs = 'Your score is ';
    //New for 6.2.2.0
    var CompletedSoFar = 'Completed so far:';
    var ExerciseCompleted = 'You have completed the exercise.';
    var ShowCompletedSoFar = true;
    var ContinuousScoring = true;
    var CorrectFirstTime = 'Questions answered correctly first time: ';
    var ShowCorrectFirstTime = false;
    var ShuffleQs = false;
    var ShuffleAs = true;
    var DefaultRight = 'Correct!';
    var DefaultWrong = 'Not perfect yet. Please try again.';
    var QsToShow = 9;
    var Score = 0;
    var Finished = false;
    var Qs = null;
    var QArray = new Array();
    var ShowingAllQuestions = false;
    var ShowAllQuestionsCaption = 'Show all questions';
    var ShowOneByOneCaption = 'Show questions one by one';
    var State = new Array();
    var Feedback = '';
    var TimeOver = false;
    var strInstructions = '';
    var Locked = false;
    //The following variable can be used to add a message explaining that
    //the question is finished, so no further marking will take place.
    var strQuestionFinished = '';
    function CompleteEmptyFeedback(){
              var QNum, ANum;
              for (QNum=0; QNum<I.length; QNum++){
    //Only do this if not multi-select
                        if (I[QNum][2] != '3'){
                          for (ANum = 0; ANum<I[QNum][3].length; ANum++){
                                    if (I[QNum][3][ANum][1].length < 1){
                                              if (I[QNum][3][ANum][2] > 0){
                                                        I[QNum][3][ANum][1] = DefaultRight;
                                              else{
                                                        I[QNum][3][ANum][1] = DefaultWrong;
    function SetUpQuestions(){
              var AList = new Array();
              var QList = new Array();
              var i, j;
              Qs = document.getElementById('Questions');
              while (Qs.getElementsByTagName('li').length > 0){
                        QList.push(Qs.removeChild(Qs.getElementsByTagName('li')[0]));
              var DumpItem = 0;
              if (QsToShow > QList.length){
                        QsToShow = QList.length;
              while (QsToShow < QList.length){
                        DumpItem = Math.floor(QList.length*Math.random());
                        for (j=DumpItem; j<(QList.length-1); j++){
                                  QList[j] = QList[j+1];
                        QList.length = QList.length-1;
              if (ShuffleQs == true){
                        QList = Shuffle(QList);
              if (ShuffleAs == true){
                        var As;
                        for (var i=0; i<QList.length; i++){
                                  As = QList[i].getElementsByTagName('ol')[0];
                       

    .oO(dd.l)
    > I want to insert a HTML file( so-called A) in a small
    area in another HTML
    >file( so-called B) .
    > Now the B has been done, and A is from another server
    and its URL is known.
    >How to do that?
    > I'm new to Dreameaver, so anyone can explain or give me
    useful hints?
    Use an iframe. Do a search on Google or use the F1 help for
    details.
    Be aware of possible drawbacks and usability problems,
    dependent on
    what you're actually trying to accomplish.
    Micha

  • Display HTML in JEditorPane

    Hi
    I am trying to display a String containing HTML text on a JEditorPane.
    I have downloaded the HTML from a webpage using sockets, and now I want to display the downloaded page. I have a project in school about sockets.
    This is why I can't use getPage(URL);
    The following is the code I am using:
    String temp = "String with HTML text"
    HTMLEditorKit htmlEdKit = new HTMLEditorKit();
    JEditorPane.setEditorKit(htmlEdKit);
    JEditorPane.setContentType("text/html");
    JEditorPane.setEditorKitForContentType("text/html", htmlEdKit);
    JEditorPane.setContentType("text");
    JEditorPane.setText(temp);
    When I run the code, all that is displaying is the raw HTML code, with all the tags. As I understand it, this is how it should be done.
    What is wrong, would appreciate some help.
    /David Mossberg

    it's not necessary to use socket but if use socket get the inputstream from it.
    in = socket.getinputstream(); //return inputstream from socket
    htmldoc = JEditorPane.getDocument(); //return the htmldoc in JEditorPane
    if(htmldoc.getlength()>0)
    htmldoc.remove(0,htmlDoc.getLength());//if the htmldoc has some content then remove it
    reader = new InputStreamReader(in);//construct a new reader from in
    JEditorPane.getEditorKit.read(reader,htmldoc,0); //read new content into the htmldoc from reader
    Hope the above code helps you.
    joney

  • Inserted HTML and Images

    Is it possible when inserting html in Muse, to have images within the html text? If we will be using Adobe Catalyst, what will I need to do to properly code the images into the text?

    Hello,
    You can use the <img> tag between the text. More info on : http://www.w3schools.com/tags/tag_img.asp
    In place of Image Path, use "/Assets/Filename.extension" (replace filename.extension with the filename of the image).
    After that use File>Add files for upload and select the image so that it gets added to Assets folder when you Publish the site.
    You might not be able to preview it but you can use File>Export as HTML and view the whole site exported in a local folder.
    Regards,
    Sachin

  • Inserting HTML on a Slide

    Is there a way to insert html code into a slide? I need to place a video on a slide that uses an iframe and a link to a JavaScript file. The video is being delivered from a content management system (Qumu) so I don't have many options. I don't see any way to accomplish this.
    Thanks

    You can put your images in public_html directory.

  • Inserting HTML into JTextPane

    Hi,
    I am trying to insert HTML into JTextPane.
    I am using the following code for the same.
    JTextPane jedit = new JTextPane();       
    jedit.setContentType("text/html");
            HTMLDocument doc = (HTMLDocument)jedit.getDocument();
            String text = "<a href=\"???\">hyperlink</a>asd<a href=\"???\">hyperlink123</a>";
            HTMLEditorKit editorKit = (HTMLEditorKit)jedit.getEditorKit();
            editorKit.insertHTML(doc, doc.getLength(), text, 0, 0, null);
            doc.insertString(doc.getLength(),"Hi testing",null);
            text = "<a href=\"???\">hyperlink123</a>";The problem is that the HTML gets inserted into new line. I do not want the new line.
    I know there is an API like insertBeforeEnd(...) but do not know how to use that.
    Any help for the above problem will be of great use.
    Thanks.

    look I have got the answer ... I guess this would be the root cause of the problem of new line.
    when ever you want the text to be inserted
    -at new line provide the last argument  of HTMLDocument.insertHTML as null
    - at same line provide the last argument as the HTML tag you are inserting into the JtextPane's document.thats it !!!
    ENJOY :-)

  • Inserted HTML does NOT push content when resized

    Hi,
    we are building a website for a hotel and are bound to include their channel manager module into the site. In order to do that, you have to follow these steps:
    1. Paste JavaScript code into the head section to load the module.
    2. Place a short line of code with "insert HTML" into the site where the module should appear and that's it.
    The module is generated by a server-side script from the channel manager's server and pasted into an iFrame that is also generated by this very script. The thing is: It resizes the height of the iFrame depending on the displayed content in the iFrame. So we start with 301 px height when we call the page and start the search for free rooms. The results are displayed on a 1400 px iFrame, which resizes properly when showing the results.
    THE PROBLEM: The footers stays put and the iFrame runs behind it and off the display port. There is also no scrollbar showing up allowing me to scroll to the bottom of the iFrame.
    We got three layers:
    3. Top Layer (Containing top navigation and footer, both defined in a master page that is applied to the content page)
    2. Content Layer (Containing the inserted HTML with the generated iFrame)
    1. Background Layer (Well, it contains background elements)
    WE NEED: The footer to be pushed by the ever resizing iFrame and get a scrollbar when neccessary due to iFrame height.
    What are we doing wrong?

    Thank you for your suggestions, although I don't think they will fix the problem.
    We cannot alter the server script in any way, since it is located on the channel manager's server and is just called with a customer id to show our client's hotel related data. They resize the iFrame using an inline height style tag. This causes the page to not recognize the size change and not even showing a scrollbar at all, when the iFrame exceeds the view port.
    We already put a div around the JS-call which expands with the iFrame as expected.
    <div id="u1218"><!-- custom html -->
    <div>
    <script language="javascript" type="text/javascript">
    function();
    </script>
    </div>
    </div>
    This results in an iFrame inserted after the script tag, the div around the script expands correctly. We already removed any master page objects, created a blank new master page to define header and footer areas and pasted our menu and footer directly into the page of question on the same layer as the inserted html box went. So for our understanding the expanding div around the script should push the footer on this page to whereever it ends. It just doesn't. Also we do not get any scrollbar, although the iFrame clearly gets larger than the viewport area and the page just doesn't recognize it.

  • How does one remove inserted HTML?

    I inserted HTML on a page and it must now be removed. I know it is there in the HTML code, but it does not show when I "Insert HTML" from the Object dropdown.How can I remove the code?

    I finally noticed the embedded HTML object on the page and cntrl-clicked; voila, embedded code was there. I deleted/emptied the contects and exported HTML again. Sadly, more embedded HTML code persists and the HTML object panel is now empty. How do I clean the .muse file?  Here is the embedded code:
      <div class="grpelem" id="u953"><!-- custom html -->
        <embed src=“moosic.mp3" autostart="true" loop="false" hidden="true"></embed>
    </div>
       <div class="grpelem" id="u955"><!-- custom html -->
        <embed src=“moosic.mp3" autostart="true" loop="false" hidden="true"></embed>
    </div>
       <div class="grpelem" id="u957"><!-- custom html --></div>

Maybe you are looking for