aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Pass Info to a popup window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Pass Info to a popup window" Watch "Pass Info to a popup window" New topic
Author

Pass Info to a popup window

Mkhaya Tini
Greenhorn

Joined: Oct 06, 2005
Posts: 23
Is there any way to pass info to a pop up window?

say i've this function:

function getMeaning(hexmsg){

window.open ("../views/translate.jsp","mywindow","status=1");
}

what i need is to show the "hexmsg" variable in that popup window.

please help.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Try searching the forum since it is asked many times here.

Eric
Mkhaya Tini
Greenhorn

Joined: Oct 06, 2005
Posts: 23
Ok, i kinda figured it out but again not really. I'm having a really weird problem:

I've a table. the content of each cell are unequal and when showing all, it does not look good. so, what i'm trying to do is, show only the first 30 letters and when click on these 30 letters a pop up window will show up and show the whole string. here is the javascript function i'm using:

function showAll(message){

var newWin = window.open ("../views/showmessage.jsp");
var fi = newWin.document.getElementById("shwmsg");
fi.value = message;
}

where shwmsg is a text field in the popup window. the weird problem is, it is working or not working - completely randomly. I click on the link, nothing happens. I mean, the popup window shows up, but the text field is empty. I keep clicking and may be after 5 times, the messages shows up in the text field. then again it does not show. after may be another 3/4 click it shows. if it works, it should work all the time, and if it does not it should never work. does anyone have a clue?

off topic, but if someone can give me another way of doing this besides pop up, i might try using that too. thanks.
[ October 11, 2005: Message edited by: Mkhaya Tini ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61587
    
  67

off topic, but if someone can give me another way of doing this besides pop up, i might try using that too. thanks.


Use the title attribute to show the entire string as a 'tooltip' when the mouse hovers over the truncated string.

Or, use a floating div that emulates a 'tooltip' to show it.

I would personally not use a heavy-weight popup for this purpose.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mkhaya Tini
Greenhorn

Joined: Oct 06, 2005
Posts: 23
can u please tell me more about floating div please. an example or link would be nice. thanks or reply.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61587
    
  67

Mkhaya please use real words rather than short-cuts like "u".

To "float" a div, use CSS to give it a z-index higher than any other, and to specify its dimensions and placement. The CSS display attribute can be used to show and hide the div (using values of 'block' and 'none', respectively).
Mkhaya Tini
Greenhorn

Joined: Oct 06, 2005
Posts: 23
ToolTipText (title) is easy to implement but does not give the ability to print, which I need. Float is not working for this purpose either. can someone help me with sending a value to a popup window?

all i need is, create a popup from a main window, pass a value to the popup and show that value. anyone? thanks in advance.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
http://radio.javaranch.com/pascarello/2005/01/18/1106063002000.html
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Stop it Eric, you're supposed to be on holidays
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Originally posted by David O'Meara:
Stop it Eric, you're supposed to be on holidays


I am back! Wish I wasn't!

Eric
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Ah, I though you were saying you were passing through. My mistake.

HTML/JS isn't the same withour you
Mkhaya Tini
Greenhorn

Joined: Oct 06, 2005
Posts: 23
thanks Eric Pascarello, it has been very helpful. another quick question for you, if you don't mind. is there a way to show the content of a javascript variable say var x ="Java Ranch" inside a paragraph?

so the final output will show the words "Java Ranch" but not in a text box or something like that but inside a <p>....</p> attribute.

the reason I need this is formatting. none of the <b>,<i> or stuff like those works in a textarea.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61587
    
  67

If you assign an id to a span (or other containing element), you can replace or augment its content with the innerHTML property.



and in script


[ October 13, 2005: Message edited by: Bear Bibeault ]
Mkhaya Tini
Greenhorn

Joined: Oct 06, 2005
Posts: 23
u are the man!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pass Info to a popup window