473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Popping up text in a window

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 -
Jul 20 '05 #1
2 1929
D. Alvarado wrote:
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 -


How about this approach? If you like this, you can make the window any
size, with or without scroll bars, and you can make it appear centered.
Once you get started post your code and you can get specific help for
any features you want to work on.

Mike
<html>
<title>CodeAve.com(JavaScript New Window within Previous Page)</title>
<body bgcolor="#FFFFFF">
<script language="JavaScript">
<!--
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

new_window.document.write("<html>");
new_window.document.write("<head>");
new_window.document.write("<meta http-equiv='Content-Type'
content='text/html; charset=windows-1252'>");
new_window.document.write("<title>Table of Data</title>");
new_window.document.write("<style type='text/css'>");
new_window.document.write(" td { text-align: right; }");
new_window.document.write(" td.1 { text-align: left; }");
new_window.document.write("</style>");
new_window.document.write("</head>");
new_window.document.write("<body>");
new_window.document.write("<table border='1' cellspacing='1' width='555'
height='246' style='border-collapse: collapse'>");
new_window.document.write(" <tr>");
new_window.document.write(" <td class = '1' width='111'>Sonnenstand
in Grad über dem Horizont ein<br>Elevation of the sun (degrees above the
horizon</td>");
new_window.document.write(" <td class = '1' width='111'>Optimaler
Anstellwinkel des Spiegels °A<br>Optimal mirror orientation °A</td>");
new_window.document.write(" <td class = '1'
width='111'>Energieerzeugung Watts<br>Power output Watts</td>");
new_window.document.write(" <td class = '1' width='111'>Mit der
erzeugten Energie können Sie Grams<br>With the above displayed energy
you can heat Grams</td>");
new_window.document.write(" <td class = '1' width='111'>converted to
lbs:</td>");
new_window.document.write(" </tr>");
new_window.document.write(" <tr>");
new_window.document.write(" <td>0°</td>");
new_window.document.write(" <td>60°</td>");
new_window.document.write(" <td>138,56 W</td>");
new_window.document.write(" <td>552 g</td>");
new_window.document.write(" <td>1 lb 3.5 ozs</td>");
new_window.document.write(" </tr>");
new_window.document.write("</table>");
new_window.document.write("</body>");
new_window.document.write("</html>");

// close the document
new_window.document.close();
}
// -->
</script><a onclick="open_new_window()"
style="cursor:pointer;cursor:hand;" ><font color="#008080"><u>Open New
Window</u></font></a>

</body>
</html>

Jul 20 '05 #2
On Sat, 14 Feb 2004 19:08:05 -0800, mscir <ms***@access4less.net> wrote:
<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:

<script type="text/javascript">
<!--
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

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John | last post by:
Is it possible to use PHP to pop a small window to display some quick information. For example if someone adds an item to a shopping cart, a small window should pop up, saying the item has been...
17
by: Paul Rubin | last post by:
Dumb question from a Windows ignoramus: I find myself needing to write a Python app (call it myapp.py) that uses tkinter, which as it happens has to be used under (ugh) Windows. That's Windows...
2
by: Ram | last post by:
I have a console application that brings up a dialog if invoked with no command line parameters. If I double click on my application a console window is briefly displayed before the dialog appears...
3
by: Lee David | last post by:
I'm trying to have a popup window of new changes when a person comes to my web page and something has changed. I can see the "alert" popping up, but not the page. The page would look better and...
4
by: VB Programmer | last post by:
I am created a ASPX web app. I am using forms authentication and it seems to be working well. After logging in I am redirected to a form that is a "Secure" directory. It's using data coming...
3
by: Learner | last post by:
Hello, I have two buttons on one of my VehicleDetails.aspx page. Obiviously these two buttons takes the user to two different pages. Now my client is interested in having a linkbutton instead of...
12
by: icarus | last post by:
platform: windows xp professional, python 2.5, wxpython When I double-check on my program file test.py (for simplicity I'll be using this code below), I see the window just fine. But the ms-dos...
1
by: Lie Ryan | last post by:
On Wed, 01 Oct 2008 11:33:59 +0100, dudeja.rajat wrote: The root window is the main window, not the DOS box. I think in windows, you should use pythonw.exe or something to open the python...
20
by: cowboyrocks2009 | last post by:
Hi, I need help to automate my code to take data from input file. Also I need to create it as a function so that I can pass it to some other program. I am new to Java so having a bit limitation to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.