Solved

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

Posted on 2001-08-23
11
243 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
[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
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

737 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