473,890 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

open.window() and passing URL string

Hey there... I'm having some problems passing url parameters with an
open.window command. I'm not terribly familiar with java script but
here is the code below.

When executed it opens the window properly but does not pass the
parameter.

(this is part of a coldfusion template)

<a href="##"
onClick="window .open('photopag e#.htm?region=# slave.region#', 'prop1','locati on,menubar,heig ht=600,width=80 0,scrollbars,re sizable,toolbar =yes');
return false;"><img src="#trim(phot odir)#/#photoname4#" width="90"
height="60" hspace="2" vspace="2" border="2"></a>
Thanks,
Wayne

Aug 25 '05 #1
29 5040
wayne wrote:
Hey there... I'm having some problems passing url parameters with an
open.window command. I'm not terribly familiar with java script but
here is the code below.

When executed it opens the window properly but does not pass the
parameter.

(this is part of a coldfusion template)

<a href="##"
onClick="window .open('photopag e#.htm?region=# slave.region#', 'prop1','locati on,menubar,heig ht=600,width=80 0,scrollbars,re sizable,toolbar =yes');
return false;"><img src="#trim(phot odir)#/#photoname4#" width="90"
height="60" hspace="2" vspace="2" border="2"></a>


Are all those hashes '#' from coldfusion? Your link above will do
nothing in a browser with JavaScript disabled or not available. Put
your URL into the href attribute and open the popup using something like:
<script type="text/javascript">
function popWin( u, n, atts ){
aWin = window.open( u, n, atts);
}
</script>

<a href="photopage #.htm?region=#s lave.region#" target="_blank"
onclick="
popWin(this.hre f,'prop1','heig ht=600,width=80 0');
return false;
"><img ... ></a>
Now the link will open in a pop-up whether the user has scripting or
not. If scripting is available, the window may have your suggested
attributes. If scripting is not available, the URL will open in a
standard pop-up.

--
Rob
Aug 26 '05 #2
ASM
wayne wrote:
Hey there... I'm having some problems passing url parameters with an
open.window command. I'm not terribly familiar with java script but
here is the code below.

When executed it opens the window properly but does not pass the
parameter.
if browser reads : <img src="#trim(phot odir)#/#photoname4#"
and #trim(photodir) # or #photoname4#
are coldFusion entries, there is a problem with your coldFusion code ...
or your ColdFusion Server

Which parameter(s) do you want to send ?
region=#slave.r egion# ->
region's value is #slave.region# or slave.region ?
because # has signification in an url (anchor)

I would have done, and you would have to get in browser :
photopage.htm?r egion=slave.reg ion#somewhere
where :
- photopage.htm is the page to load
- region is a parameter
- slave.region is the parameter value
- somewhere is an anchor on the page to scroll to

photopage.htm?r egion=slave.reg ion&city=Small-Town#somewhere
- region = 'slave.region'
- city = 'Small-Town'

in my test, in popup window, location bar displays exactly :
photopage.htm?r egion=slave.reg ion&city=Small-Town#somewhere

parameters well are send (no coldFusion used)
(this is part of a coldfusion template)

<a href="##"
onClick="window .open('photopag e#.htm?region=# slave.region#', 'prop1','locati on,menubar,heig ht=600,width=80 0,scrollbars,re sizable,toolbar =yes');
return false;"><img src="#trim(phot odir)#/#photoname4#" width="90"
height="60" hspace="2" vspace="2" border="2"></a>


wouldn't something be missing :
window.open('ph otopage#.htm?re gion=#slave.reg ion#
insteed of :
window.open('#p hotopage#.htm?r egion=#slave.re gion#
--
Stephane Moriaux et son [moins] vieux Mac
Aug 26 '05 #3
Thanks Rob... worked great!

Hey? is there a way to bring a window (opened with an open.window
script) back in to focus should it get buried under another window. It
seems to be a common problem. A user opens a window with the
open.window script then the user clicks somewhere on their desktop and
the window disappears under another application. From that point on
any subsquent clicks on the original link with the open.window command
delivers the content to the window but since it's buried the user
doesn't know.

Thanks,
Wayne

Aug 26 '05 #4
wayne wrote:
Thanks Rob... worked great!
It's usual practice to quote what you are replying to so we know what
worked great ... but thanks for the glory! ;-)

Hey? is there a way to bring a window (opened with an open.window
script) back in to focus should it get buried under another window.
Yes. Test the window.closed property, if it's false, the window has
been closed. An example below:
<script type="text/javascript">

var aWin;

function popWin( u, n, atts ){
if ( aWin && ! aWin.closed ) {
if ( aWin.location.h ref != u ) {
aWin.location.h ref = u;
}
aWin.focus();
} else {
aWin = window.open( u, n, atts);
aWin.focus();
}
}

</script>
seems to be a common problem. A user opens a window with the
open.window script then the user clicks somewhere on their desktop and
the window disappears under another application. From that point on
any subsquent clicks on the original link with the open.window command
delivers the content to the window but since it's buried the user
doesn't know.

Thanks,
Wayne

--
Rob
Aug 26 '05 #5
RobG wrote :
<script type="text/javascript">

var aWin;

function popWin( u, n, atts ){
if ( aWin && ! aWin.closed ) {
if ( aWin.location.h ref != u ) {
aWin.location.h ref = u;
}
aWin.focus();
} else {
aWin = window.open( u, n, atts);
aWin.focus();
Can you explain why you need this instruction on the line above?
The way I see this is: if the window pointer is inexistent in memory or
if the window has been closed, then create the window. Now, why would
you need to focus it right after creating it?
}
}

</script>

Gérard
--
remove blah to email me
Aug 26 '05 #6
RobG wrote :
<script type="text/javascript">
function popWin( u, n, atts ){
aWin = window.open( u, n, atts);
}
</script>

<a href="photopage #.htm?region=#s lave.region#" target="_blank"
onclick="
popWin(this.hre f,'prop1','heig ht=600,width=80 0');
return false;
"><img ... ></a>


Why not target="prop1" ?
Also, note that the requested window will not be resizable and will not
render scrollbars if needed, if content overflows requested window
dimensions. Also the window.open() call tries to disable status bar. For
many reasons, none of this is recommendable.

Gérard
--
remove blah to email me
Aug 26 '05 #7
Gérard Talbot said the following on 8/26/2005 6:17 PM:
RobG wrote :
<script type="text/javascript">
function popWin( u, n, atts ){
aWin = window.open( u, n, atts);
}
</script>

<a href="photopage #.htm?region=#s lave.region#" target="_blank"
onclick="
popWin(this.hre f,'prop1','heig ht=600,width=80 0');
return false;
"><img ... ></a>


Why not target="prop1" ?


<a href="...." target="myWindo w"
onclick="popWin (this.href,this .target .....); return false"..
Is definitely a preferred way, especially from a maintenance standpoint.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Aug 26 '05 #8
ASM
Gérard Talbot wrote:
RobG wrote :
<script type="text/javascript">
function popWin( u, n, atts ){
aWin = window.open( u, n, atts);
}
</script>

<a href="photopage #.htm?region=#s lave.region#" target="_blank"
onclick="
popWin(this.hre f,'prop1','heig ht=600,width=80 0');
return false;
"><img ... ></a>

Why not target="prop1" ?


because return false; :-)
Also, note that the requested window will not
Wasn't it what wanted ?
For
many reasons, none of this is recommendable.


Which reasons ?

I think I've seen at mozilla.org(*)
that height and width would have to be dimensions of viewing area
So, f you know which space you need,
why not to freeze a naked window to this size ?
(*) http://developer.mozilla.org/en/docs/DOM:window.open

--
Stephane Moriaux et son [moins] vieux Mac
Aug 27 '05 #9
Gérard Talbot wrote:
RobG wrote :
<script type="text/javascript">
function popWin( u, n, atts ){
aWin = window.open( u, n, atts);
}
</script>

<a href="photopage #.htm?region=#s lave.region#" target="_blank"
onclick="
popWin(this.hre f,'prop1','heig ht=600,width=80 0');
return false;
"><img ... ></a>

Why not target="prop1" ?


Indeed.
Also, note that the requested window will not be resizable and will not
render scrollbars if needed, if content overflows requested window
dimensions. Also the window.open() call tries to disable status bar. For
many reasons, none of this is recommendable.
The OP can attempt to set whatever attributes he wants. I reduced the
attributes to width and height for brevity.

In regard to your post above regarding the superfluous focus(), yeah,
it's superfluous.

Gérard
--
remove blah to email me

--
Rob
Aug 27 '05 #10

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

Similar topics

6
12183
by: lukeo | last post by:
I'm shelling out to an .asp (or htm) page from an application. I want to show this in a window without the address bar, etc... Is there a way I can redirect this page using javascript to a page where I can set the window height, statusbar=no, etc? Thanks, -Luke
5
5102
by: Nicola Pedrozzi | last post by:
Here I really need a guru... ;^( I found out today with a big disappointment that : window.open("url", ...) and also navigate("url") limit the max length of the url string to something like 2080 characters. That on Explorer only; Netscape and Mozilla work perfectly
2
21851
by: tripyre | last post by:
I recently resolved an issue I had with passing a variable to a call shell command, but now I need it to pause or leave the window open so I can manually close it. Below is my code, and I am not sure where to begin to keep the DOS window from closing. Dim stAppName As String Dim stIPAddress As String stAppName = "C:\WINDOWS\system32\ping.exe " stIPAddress =
5
8334
by: David | last post by:
Hi I don't want to use javascript to open a new window because I want to use server side code which gives me more control. I think I can not use response.redirect to open a new window and keep the current window. Is there any way to do it? Thank you! David
2
6710
by: RJN | last post by:
Hi Is it possible to a server.transfer and open the page in a new window? I need to pass values between forms and hence using server.transfer. I do not want to use query string for passing values. Regards Rjn
6
21416
by: shil | last post by:
I have a server side button that needs to do some preperation and afterwards, if everything goes well, open a new browser with a specific url. I know how to execute javascript from a server side control, adding the javascript to the attributes. I need to open the browser window AFTER the code behind event is finished. For example I have two text boxes on the form, whose values I want to send as parameters to the URL that I want to...
3
4076
by: Aaron | last post by:
I am having a little difficulty with a relatively simple task. I have a parent webform. I have a javascript attribute added to a button to open a new window when clicked. The user fills in a textbox then clicks the button and on page load the child window should grab that val run a query an present the results. Given that I am bouncing between server side controls and client script. I am just having a little trouble passing my textbox...
4
1982
by: Bob Bedford | last post by:
Hi all, I'm stuck with some php code that runs out of time limit. This is due to a long XML file process that has to save pictures on the disk. What I've now: - read XML file - parse XML file - for every article - save datas in Database
5
8345
by: Nicholas | last post by:
Hello, i need to pass an argument to window.open but it seems it wont work. What am i doing wrong? This in in head: <SCRIPT LANGUAGE="JavaScript"> <!-- function nw(a,b){ myWindow = window.open("", "Window", 'toolbar,width=a,height=b') //-->
0
9976
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9815
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11215
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10451
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8008
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6035
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4259
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.