Solved

display html code

Posted on 2003-10-23
10
600 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
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
 
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now