?
Solved

display html code

Posted on 2003-10-23
10
Medium Priority
?
608 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 31

Accepted Solution

by:
seanpowell earned 200 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 200 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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

777 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