Popping up text in a window

D

D. Alvarado

Hello,
Just wanted to check if this was possible. I have n blocks of text
and I would like each to pop up in a window. Hoever, I don't want to
create n different HTML pages and invoke each one through window.open.
Is there some way I can call window.open and pass the text to it and
have that text appear in the popup window? Styling is not important.
I don't care if the text just appears in plain font.

Thanks -
 
M

Michael Winter

<html>
<title>CodeAve.com(JavaScript New Window within Previous Page)</title>
<body bgcolor="#FFFFFF">

Why don't you add this to the CSS rules below?

body {
background-color: #ffffff;
}
<script language="JavaScript">

Missing the required type attribute. Change to:


Don't use SGML comments in script blocks
function open_new_window() {
new_window =
open("","displayWindow","width=575,height=290,left=10,top=10");

// open new document
new_window.document.open();

// Text of the new document goes here
// Replace your " with ' or \" or your document.write statements will //
fail

Or use single quotes for the document.write statements and escape
apostrophes.
new_window.document.write("<html>");

No DOCTYPE? Tsk, tsk.

[snip]
</script><a onclick="open_new_window()"
style="cursor:pointer;cursor:hand;" >

You do realise that the first rule (cursor: pointer) in the style
attribute above is totally useless, don't you?
<font color="#008080"><u>Open New Window</u></font></a>

Again, why not use a CSS rule instead of deprecated elements?

a {
color: #008080;
cursor: hand;
text-decoration: underline;
}
</body>
</html>

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top