Buying HTML Encoding Problem

Discussion in 'Programming' started by colinph970, May 6, 2012.

  1. #1
    I'm looking to find a way to enter some normal html coding into a submission box, convert it to encoded html and be able to see what the encoded html would look like on a webpage that is built to accept it. Is there a way of doing this? If not, could you code it?

    An an example:

    enter this:
    <bold style="font-weight: bold;">this is bold</bold><span style="font-weight: bold;">

    convert it to this:
    &lt;bold style=&quot;font-weight: bold;&quot;&gt;this is bold&lt;/bold&gt;&lt;span
    style=&quot;font-weight: bold;&quot;&gt;

    and then view what it would look like on a page:
    this is bold
     
    colinph970, May 6, 2012 IP
  2. locpicker

    locpicker Well-Known Member

    Messages:
    789
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    160
    As Seller:
    100% - 1
    As Buyer:
    100% - 0
    #2
    Is this is just for you there are a number of free programs that you can get that have WYSIWHG (what you see is what you get) editors.
     
    locpicker, May 6, 2012 IP
  3. hdewantara

    hdewantara Well-Known Member

    Messages:
    540
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Untested,
    but this might just be an oversimplified example, a very basic one :)

    
    <html>
    <body>
      Put your HTML Code here: <textarea rows="5" cols="40" id="htmlCode"></textarea>
      <br/><input type="button" value="Click to preview HTML" 
        onclick="document.getElementById('htmlPreview').innerHTML = document.getElementById('htmlCode').value" />
      <br/>HTML Preview: <div id="htmlPreview"></div>
    </body>
    <html>
    ...
    PHP:

    Hendra
     
    hdewantara, May 7, 2012 IP