473,396 Members | 2,011 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,396 software developers and data experts.

need help on openning a new window

Hi, I want to open a new window without tool bar, address bar and status bar.
then inside the page, there are a few links, i want, when clicking a link, a new
window opens, but still without tool bar, address bar and status bar.
My code can open the first new window properly, but it cannot open the second
one at all. Could anyone please help me?

function popOpen(url,name,attributes) {
windowHandle = window.open(escape(url),name,scrollbars = 1,"'left=20,top=20");
}
Jul 23 '05 #1
3 2961
Hi Yaqian,

Does the url of the second page also have function popOpen so that you
can open a second page?
If yes, then did you check to see that the function is called
correctly?

Jul 23 '05 #2
"Yaqian" <y.****@uq.edu.au> wrote in message
news:d9***********@bunyip2.cc.uq.edu.au...
Hi, I want to open a new window without tool bar, address bar and
status bar.
then inside the page, there are a few links, i want, when clicking a
link, a new
window opens, but still without tool bar, address bar and status bar.
My code can open the first new window properly, but it cannot open the
second
one at all. Could anyone please help me?

function popOpen(url,name,attributes) {
windowHandle = window.open(escape(url),name,scrollbars =
1,"'left=20,top=20");
}


The third parameter of window.open() is a comma-separated string of
attributes:

window.open(url, name, "scrollbars=1,left=20,top=20");

You do not need to, nor should you, escape the URL... if there is query
string content that needs to be URI encoded, that should be done before
passing the url to your popOpen() function, or pass the query string
name/value pairs as object property/values so you can escape (not really
encodeURI(), but it will have to do if you want to support user agents
which don't support encodeURI()) each query value as it is appended to
the url:

function popOpen(url, queryPairs, name, attributes) {
var queryString = [];
for (var queryPair in queryPairs) {
// escape() could be encodeURI() if you
// can guarantee it will be available
queryString.push(queryPair + '=' +
escape(queryPairs[queryPair]);
}
w = window.open(
url + (queryString.length > 0 ? '?' + queryString.join('&')
: ''),
name,
attributes
);
}

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
Grant Wagner a écrit :
"Yaqian" <y.****@uq.edu.au> wrote in message
news:d9***********@bunyip2.cc.uq.edu.au...
Hi, I want to open a new window without tool bar, address bar and
status bar.
then inside the page, there are a few links, i want, when clicking a
link, a new
window opens, but still without tool bar, address bar and status bar.
My code can open the first new window properly, but it cannot open the
second
one at all. Could anyone please help me?

function popOpen(url,name,attributes) {
windowHandle = window.open(escape(url),name,scrollbars =
1,"'left=20,top=20");
}

The third parameter of window.open() is a comma-separated string of
attributes:

window.open(url, name, "scrollbars=1,left=20,top=20");

You do not need to, nor should you, escape the URL... if there is query
string content that needs to be URI encoded, that should be done before
passing the url to your popOpen() function, or pass the query string
name/value pairs as object property/values so you can escape (not really
encodeURI(), but it will have to do if you want to support user agents
which don't support encodeURI()) each query value as it is appended to
the url:

function popOpen(url, queryPairs, name, attributes) {
var queryString = [];
for (var queryPair in queryPairs) {
// escape() could be encodeURI() if you
// can guarantee it will be available
queryString.push(queryPair + '=' +
escape(queryPairs[queryPair]);
}
w = window.open(
url + (queryString.length > 0 ? '?' + queryString.join('&')


Shouldn't that be '&amp;' instead of '&'?
Just asking.
: ''),
name,
attributes
);
}


Gérard
--
remove blah to email me
Aug 19 '05 #4

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

Similar topics

3
by: Fang | last post by:
Hi, I'm using the following code to open a new window in specified size, and I don't want it to be located at the default position. Strangely, seems only "top" can work. Could anyone please help...
5
by: Tedmond | last post by:
Dear all, How can I get all the titles of all openning windows? I found a API in win32 that called EnumWindows() but it returns only the windows handles, not titles. How can I get the list just...
4
by: Ohad Young | last post by:
Hi, I need to open (launch) an external application from my winform application. The application is not a dot.net application, for example the windows calculator. I'm using the...
4
by: HVG | last post by:
Hi, is it possible to render a whole page (ie. a aspx webform) to a string _without_ actually loading the page in a window? Eg if Iam executing page1.aspx at the server, I would then like to...
2
by: HVG | last post by:
My previous post on this didnt quite find a solution, so can we try again please? My senario is that from the codebehind in "page1.aspx", I wish to render "page2.aspx" (ie. a totally a...
2
by: Eitan | last post by:
Hello, I want open a new page (on the same window), by using some vb script (I am in aspx file). How can I do that ? Thanks :)
1
by: tshad | last post by:
I have a situation where I could Try Open a Connection ExecuteReader Close Reader Catch may not happen - Possible if this a Timer in a Windows Service
9
by: bj19138 | last post by:
How do you have your browser maximized when openning. When I open my Browser it always is minimized.?
1
by: mahesh123 | last post by:
Hi, I am using the VB6.0 and for report crystal reports 8.0. the reports are not openning(means its openning but immediately it is closed the report) when we installed the reports in other system....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.