Solved

display html code

Posted on 2003-10-23
10
603 Views
Last Modified: 2013-12-16
hello,
i maintain a website that provides counters.  To install the counters i  have a page that gives them the html.  here is the page:

http://myfreecounter.net/gethtml.php?id=1

but when users copy the html and paste it into ms Frontpage or another html editor, it usually changes to this:

<script src="http://www.myfreecounter.net/script.php?id=1" language="Javascript1.2"></script>
<noscript><img src="http://www.myfreecounter.net/noscript.php?id=1"></noscript>

it does that even if they copy it in HTML mode.  I thought about using a textarea to display the html to paste, but i wouldnt think that would look polished, i need something that will look nice, but still copy correctly.

thank you,
Matt
0
Comment
Question by:mattjp88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 29

Expert Comment

by:coreybryant
ID: 9610477
I think that you would need to either use the text area - or tell the FP users to copy & paste it into notepad before pasting it into HTML.  

-Corey
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 9610716
You can try using this for a better look for the textarea:

<textarea style='overflow:hidden;background-color:#000000;color:#FFFFFF;' readonly rows='10' cols='50'><script src="http://www.myfreecounter.net/script.php?id=1" language="Javascript1.2"></script>
<noscript><img src="http://www.myfreecounter.net/noscript.php?id=1"></noscript></textarea>

You can change the colors to whatever you want

{Slam}
0
 
LVL 2

Expert Comment

by:HeadAcheMike
ID: 9611037
agreed but you should code it like this

<textarea style='overflow:hidden;background-color:#000000;color:#FFFFFF;' readonly rows='10' cols='50'>
&lt;script src="http://www.myfreecounter.net/script.php?id=1" language="Javascript1.2"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;img src="http://www.myfreecounter.net/noscript.php?id=1"&gt;&lt;/noscript&gt;
</textarea>

this makes sure the tags inside the text area wont get confused at design time and it displays properly in the browser
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 31

Accepted Solution

by:
seanpowell earned 50 total points
ID: 9611070
Or this:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Copy Code</title>
<style>
<!--
p { font-family: Verdana; font-size: 13px }
-->
</style>
</head>
<body>
<table BORDER=0 CELLPADDING=10 CELLSPACING=0>
  <tr>
    <td BGCOLOR=#cccccc align="center">
    <p><b>Just put this image tag into the BODY of your html document.</b><br>
    Click the Highlight All Button, right click the text, select copy then and paste into your html editor</p></td>
  </tr>
  <tr>
    <td BGCOLOR=#cccccc align="center">
    <form NAME="copy">
    <DIV align="center">
    <input type=button value="Highlight All" onClick="javascript:this.form.txt.focus();this.form.txt.select();">
    </DIV>
    <br>
    <textarea style='overflow:hidden;background-color:#ffffff;color:#000000;' name="txt" readonly rows='4' cols='95' WRAP=VIRTUAL>

&lt;script src="http://www.myfreecounter.net/script.php?id=1" language="Javascript1.2"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;img src="http://www.myfreecounter.net/noscript.php?id=1"&gt;&lt;/noscript&gt;

    </textarea>
    </td>
  </tr>
</table>
</form>
</body>
</html>
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 9611310
Hopefully people aren't so lazy they need an auto-select for such a short amount of text :-)

And I believe most browsers do render <tag>'s in textareas as long as they are not </textarea>, although you are right you can't be too careful with all the different browser standards out there.
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9611374
>>Hopefully people aren't so lazy
I agree - but I've had experience with people that don't "correctly" copy all the text - missing an opening or closing bracket, etc. It's just some added security...
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 9611433
I suppose you can never trust too much to the user  ;-)
0
 
LVL 7

Assisted Solution

by:Xxavier
Xxavier earned 50 total points
ID: 9611492
To be honest this is usually done on most pages ias below, there nothing wrong with a text area. Most page developers are familiar with this any anything else I think would confuse.

<html>
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!
<form>
<input type=button value="Highlight All" onClick="javascript:this.form.txt.focus();this.form.txt.select();">&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<textarea NAME="txt" ROWS=6 COLS=75 WRAP=VIRTUAL>
<script src="http://www.myfreecounter.net/script.php?id=1" language="Javascript1.2"></script>
<noscript><img src="http://www.myfreecounter.net/noscript.php?id=1"></noscript>
</textarea>
</form>
</html>

0
 
LVL 1

Expert Comment

by:paStiSSet
ID: 9618295
you can also use <blockquote> the code here </blockquote>
0
 
LVL 6

Author Comment

by:mattjp88
ID: 9924385
sorry about the delay on follow up, but your suggestions did exactly what I wanted.

thanks,
Matt
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question