473,593 Members | 2,907 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 4988
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
12154
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
5077
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
21799
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
8323
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
6695
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
21396
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
4059
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
1963
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
8327
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
8241
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
8366
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
6646
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5738
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
5402
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3853
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...
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1469
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.