How To Put HTML Code In Scroll Box

Discussion in 'HTML & Website Design' started by Syfonic, Feb 15, 2008.

  1. #1
    I am trying to put this code in a scroll box so that users can copy and paste it to other places. I do not know the code for a scroll box that will show the code. Last time I tried making it show up in a scroll box, the active image showed up in the scroll box, not the code for it.

    Here is the code:
    An example of what I want can be seen at http://infiniteadds.org/bulletin.php

    All help will be greatly appreciated.
     
    Syfonic, Feb 15, 2008 IP
  2. Syfonic

    Syfonic Peon

    Messages:
    452
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    For some reason I see <pr><pre> and </pr></pre> at the beginning and end of the above code in quote, that is not part of my code. Everything else is.
     
    Syfonic, Feb 15, 2008 IP
  3. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    437
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi SyfonicNetworks,

    The problem is simple. Everything inside the PRE element (which means "pre-formatted text") is being interpreted literally. If you want the code to appear, you need to escape your tags by using &lt; and &gt; for your < and > tag delimiters, respectively (inside the <pre> and </pre> tags of course, not the <pre> and </pre> tags themselves).

    Furthermore, that block of preformatted text (the PRE element and its containers) is not a related group of sentences that convey a single topic or have a singular meaning, so structurally and semantically speaking the paragraph is not the ideal HTML element to use here. I'd go with a DIV element instead since it's a semantically and structurally neutral block-level element.

    Hope that helps.
     
    Dan Schulz, Feb 15, 2008 IP