Solved

display html code

Posted on 2003-10-23
10
597 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
This article discusses four methods for overlaying images in a container on a web page
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

760 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

23 Experts available now in Live!

Get 1:1 Help Now