473,574 Members | 3,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing an argument to window.open ?

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="JavaS cript">
<!--
function nw(a,b){
myWindow = window.open("", "Window", 'toolbar,width= a,height=b')
//-->
</SCRIPT>

and this is in body:

<input type="button" value="open new window" onClick="nw(500 ,500)">

The problem is it opens the window but not 500x500 or any other dimension i
put
May 11 '07 #1
5 8326
On May 11, 4:15 am, "Nicholas" <nikolaatponeka ddo...@nesto.hr wrote:
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="JavaS cript">
<!--
function nw(a,b){
myWindow = window.open("", "Window", 'toolbar,width= a,height=b')
//-->
</SCRIPT>
<input type="button" value="open new window" onClick="nw(500 ,500)">

The problem is it opens the window but not 500x500 or any other dimension i
put
myWindow=window .open("", "Window", 'toolbar,width= '+a+',height='+ b)

May 11 '07 #2

"scripts.contac t" <sc************ *@gmail.comwrot e in message
news:11******** *************@e 51g2000hsg.goog legroups.com...
On May 11, 4:15 am, "Nicholas" <nikolaatponeka ddo...@nesto.hr wrote:
>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="JavaS cript">
<!--
function nw(a,b){
myWindow = window.open("", "Window", 'toolbar,width= a,height=b')
//-->
</SCRIPT>
><input type="button" value="open new window" onClick="nw(500 ,500)">

The problem is it opens the window but not 500x500 or any other dimension
i
put

myWindow=window .open("", "Window", 'toolbar,width= '+a+',height='+ b)
This wont work. So as i see when i want to pass an argument i should use
'+a+' and '+b+' instead of yut a and b
May 11 '07 #3
ASM
Nicholas a écrit :
>>
myWindow=windo w.open("", "Window", 'toolbar,width= '+a+',height='+ b)

This wont work. So as i see when i want to pass an argument i should use
'+a+' and '+b+' instead of yut a and b

myWindow = window.open('', 'myWindow','too lbar=1,width='+ a+',height='+b) ;

better with ' or " everywhere (not both)
better with no space
<button
onclick="nw(500 ,500);myWindow. document.write( 'hello');">hell o</button>
could not work with IE6 or 7 because of (bad ?) security or preferences
fixed on "No popup"
could not work on FF because of anti-popup or preferences fixed on "No
popup"
and so on ... : popup is bad !

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
May 11 '07 #4
Lee
Nicholas said:
>

"scripts.conta ct" <sc************ *@gmail.comwrot e in message
news:11******* **************@ e51g2000hsg.goo glegroups.com.. .
>On May 11, 4:15 am, "Nicholas" <nikolaatponeka ddo...@nesto.hr wrote:
>>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="JavaS cript">
<!--
function nw(a,b){
myWindow = window.open("", "Window", 'toolbar,width= a,height=b')
//-->
</SCRIPT>
>><input type="button" value="open new window" onClick="nw(500 ,500)">

The problem is it opens the window but not 500x500 or any other dimension
i
put

myWindow=windo w.open("", "Window", 'toolbar,width= '+a+',height='+ b)

This wont work. So as i see when i want to pass an argument i should use
'+a+' and '+b+' instead of yut a and b
For readability, the first person singular pronoun "I" is capitalized.

You need to find a tutorial to read until you understand what a
string literal is. 'toolbar,width= a,height=b' is a string literal
and so variable names within it are not dereferenced.
--

May 11 '07 #5
Nicholas wrote :
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="JavaS cript">
It's <script type="text/javascript">

http://www.javascripttoolbox.com/bestpractices/#script
<!--
http://www.javascripttoolbox.com/bes...ices/#comments
function nw(a,b){
myWindow = window.open("", "Window", 'toolbar,width= a,height=b')
First, either just use double quote (") or single quote (') but not both.
//-->
http://www.javascripttoolbox.com/bes...ices/#comments
</SCRIPT>

and this is in body:

<input type="button" value="open new window" onClick="nw(500 ,500)">

The problem is it opens the window but not 500x500 or any other dimension i
put
Try

<script type="text/javascript">
var WindowObjectRef erence; // creating a global variable
function nw(a,b)
{
WindowObjectRef erence = window.open("", "SecondaryWindo w",
"toolbar,width= " + a + ",height=" + b + "resizable,scro llbars");
}

You will find more useful, helpful info at:

DOM:window.open
http://developer.mozilla.org/en/docs/DOM:window.open

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
May 12 '07 #6

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

Similar topics

29
4986
by: wayne | last post by:
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="##"
3
4057
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...
2
4237
by: william.w.oneill | last post by:
I have an application that takes a few command line parameters. As recommended by others in this group, I'm using a named mutex to ensure that only one instance of the application is running. My question is how to elegantly pass a command line parameter from Instance_B to Instance_A where Instance_A was running prior to Instance_B. For...
5
3306
by: goldtech | last post by:
Hi, I'm passing what I think is a string parameter to another Python program (spawn.py) - see the code snip below. But only the counter part gets printed to a log file via spawn.py. Yet the echo print to the output window shows the whole string with the fc part. Better explained below I hope, there's the calling .py and the spawn script...
5
4488
by: kyosohma | last post by:
I have created what amounts to a simple GUI email sending program using Python + wxPython. I have modified the mailto registration in the Windows Registry so that it launches the script when someone clicks on someone's email link in a web page. While this works great if I create a convoluted path command as the registry entry and pass in...
9
4549
by: 200dogz | last post by:
Hi guys, I want to have a button which opens up a new window when pressed. <asp:Button ID="Button1" runat="server" Text="Open new window" /> ... Button1.Attributes.Add("OnClick",
5
10277
by: aelred | last post by:
I have a web page where a member can open up a chat window (child window) with another member. - From there the member can also navigate to other web pages. - From other pages in the site, they may also open up new chat windows with other members (just not the same one). - Each chat page is opened with the member name as the window name. -...
0
8273
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...
1
7862
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6514
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...
1
5658
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...
0
5336
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...
0
3775
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...
0
3794
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1375
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1102
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...

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.