Solved

How to visualize HTML-code in a javascript-window ??

Posted on 2001-08-23
11
237 Views
Last Modified: 2008-03-10
Hi,

please help! How am I able to visualize (not to execute!!!) html-code in a javascript-popup-window?

e.g. document.write("<hallo>"); should display 'Hallo' in the created js-window.

I can't manage this problem ...

Thanks, Felicitas  
0
Comment
Question by:felicitas
  • 3
  • 3
  • 2
  • +3
11 Comments
 
LVL 6

Accepted Solution

by:
JonFish85 earned 300 total points
ID: 6419005
try:

document.write("&lt;hallo&gt;")

hope this helps!
0
 
LVL 2

Expert Comment

by:tewald
ID: 6419021
First the "document.write" has to be placed in the page that is being opened in the popup window.  Try this:

file01 pops up the new window:

<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
var newWin
function newWindow(theURL,windowName,features) {
     newWin = window.open(theURL,windowName,features);
}
</script>
</head>
<body>
<a href="javascript:newWindow('file02.html','newWindow','toolbars=yes,scrollbars=yes,width=600,height=400')">Open a New Window</a>
</center>
</body>
</html>

file02 writes hallo using document.write:

<html>
<head>
<title></title>
</head>
<body>
<table width="100%">
     <tr>
          <td><script>document.write("Hallo");</script></td>
     </tr>
</table>
</center>
</body>
</html>


Hope this is what you were expecting,

tewald
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 6419396
<html>
<head>
<title>HTML Popup Example </title>
</head>
<body>

&lt;HTML&gt; <br>
&lt;HEAD&gt; <br>
&lt;TITLE&gt; <br>
This is the page title.. <br>
&lt;/TITLE&gt; <br>
&lt;/HEAD&gt; <br>
&lt;BODY&gt; <br>

Place the Body text here... <br>

&lt;/BODY&gt; <br>
&lt;/HTML&gt; <br>

</body>
</html>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6419581
If you have a lot of code to display this way, there is an easier
way then &lt; and &gt;

You can use the depreciated tag <xmp>

Any HTML between <xmp> and </xmp> will be treated as a literal by the
browser.

so document.write('<xmp><table><tr><td width="100"> hello </td></tr></table></xmp>');
would display as <table><tr><td width="100"> hello </td></tr></table>

HTH
Cd&
0
 
LVL 12

Expert Comment

by:ahosang
ID: 7961562
This question has been abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.
 
In the absence of responses, I may recommend DELETE unless it is clear to me that it has value as a PAQ. Silence = you don't care
 
ahosang
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7961732
JonFish85 was the first to answer the question as originally posted IMHO.

Cd&
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7961769
This is strange...

I never made the post above....

Fritz the Blank
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7961795
You can remember back that far?

Cd&
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7967171
Even at my age!!!! Actually, it's because I have never used &gt;

Fritz the Blank
0
 
LVL 12

Expert Comment

by:ahosang
ID: 8021800
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

points to JonFish85
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
ahosang
EE Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8092796
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

744 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

13 Experts available now in Live!

Get 1:1 Help Now