function/parameters

P

propedeutique

Hello,

I have a problem with the following function:
I would like to define the hight/length of the window which I open when
I call the function.
The problem is that the window opens but not with the size I defined
when calling the function.

Tanks for your help.


<head>
<script LANGUAGE="JavaScript">
function FuncWindow(strPage,Vlargeur,Vhauteur,)

{
var Vhauteur
var Vlargeur
string=
"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=Vlargeur,height=Vhauteur,Left=200,Top=100";
fin=window.open(strPage,"Find",string);
fin.focus();
// document.write (Vhauteur)
}
</script>
</head>

<body>
<A
onclick="FuncWindow('../pages/aide/perso_accueil_codepostal.asp',300,500)">

<input type="button" name="btnEntrer" value=" Entrer " ></a>
</body>
 
S

sujanrb

Hello,

This script works.

<head>

<script language="JavaScript">

function FuncWindow(strPage, string) {
fin = window.open(strPage, "Find", string);
fin.focus();
// document.write(Vhauteur);
}
</script>

</head>

<body>
<input type="button" name="btnEntrer" value="Entrer"
onClick="FuncWindow('../pages/aide/perso_accueil_codepostal.asp',
'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0,
resizable=1, width=500, height=480, left=200, top=100');" />
</body>
 
M

Mick White

Hello,

I have a problem with the following function:
I would like to define the hight/length of the window which I open when
I call the function.
The problem is that the window opens but not with the size I defined
when calling the function.
[...]
function FuncWindow(strPage,Vlargeur,Vhauteur){
string=
"resizable=1,width="+Vlargeur+",height="+Vhauteur+",left=200,top=100";
fin=window.open(strPage,"Find",string);
}

scrollbars will be added if the document needs them.
Mick
 
T

Thomas 'PointedEars' Lahn

This script works.

No, it does not.
<head>

<script language="JavaScript">

function FuncWindow(strPage, string) {
fin = window.open(strPage, "Find", string);

The value of `string' is used here "as is", however you pass it
below containing spaces that it must not contain.
fin.focus();

You do not test for the host object's method before you call it.
Error-prone.

// document.write(Vhauteur);

Your point?
}
</script>

</head>

<body>
<input type="button" name="btnEntrer" value="Entrer"
onClick="FuncWindow('../pages/aide/perso_accueil_codepostal.asp',
'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0,
resizable=1, width=500, height=480, left=200, top=100');" />

People using a UA without client-side script support will not
be able to make use of that button. Please Read the FAQ before
you post.

<http://jibbering.com/faq/#FAQ4_24>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top