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')
//-->
</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 5 8219
On May 11, 4:15 am, "Nicholas" <nikolaatponekaddo...@nesto.hrwrote:
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')
//-->
</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)
"scripts.contact" <sc*************@gmail.comwrote in message
news:11*********************@e51g2000hsg.googlegro ups.com...
On May 11, 4:15 am, "Nicholas" <nikolaatponekaddo...@nesto.hrwrote:
>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') //--> </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
Nicholas a écrit :
>> 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
myWindow = window.open('','myWindow','toolbar=1,width='+a+',h eight='+b);
better with ' or " everywhere (not both)
better with no space
<button
onclick="nw(500,500);myWindow.document.write('hell o');">hello</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
Nicholas said:
>
"scripts.contact" <sc*************@gmail.comwrote in message news:11*********************@e51g2000hsg.googlegr oups.com...
>On May 11, 4:15 am, "Nicholas" <nikolaatponekaddo...@nesto.hrwrote:
>>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') //--> </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
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.
--
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="JavaScript">
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 WindowObjectReference; // creating a global variable
function nw(a,b)
{
WindowObjectReference = window.open("", "SecondaryWindow",
"toolbar,width=" + a + ",height=" + b + "resizable,scrollbars");
}
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 This discussion thread is closed Replies have been disabled for this discussion. Similar topics
29 posts
views
Thread by wayne |
last post: by
|
3 posts
views
Thread by Aaron |
last post: by
|
2 posts
views
Thread by william.w.oneill |
last post: by
|
5 posts
views
Thread by goldtech |
last post: by
|
5 posts
views
Thread by kyosohma |
last post: by
| | | | | | | | | | | | |