Solved

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

Posted on 2001-08-23
11
239 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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
 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

806 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