hello,
i have got a javascript that opens a new window.
when i call the javascript function i want to ad a variable.
what you see on the pop up depends on the variable.
but the variable in the functions does not work.
on the pop up page it has the value:
$nummer = $_GET['formulier']
echo 'nummer: ' . $nummer
gives: nummer: nummer
i have tried changing the quotes in the function but it does not work
----------------------- source function call ------------
<a href='#' onClick="javascript:popupOpenen(1)">info</a>
--------------------------------------------------------
-------------------- source javascript function ---------------
<script type="text/javascript">
function popupOpenen(nummer){
win=window.open("popup.php?formulier=nummer","","t op=275,left=5,
width=900px, height=380px, scrollbars=yes");
}
</script>
-------------------------------------------------------------
thanks 8 1450
nescio said: hello,
i have got a javascript that opens a new window. when i call the javascript function i want to ad a variable. what you see on the pop up depends on the variable.
but the variable in the functions does not work. on the pop up page it has the value: $nummer = $_GET['formulier'] echo 'nummer: ' . $nummer gives: nummer: nummer
i have tried changing the quotes in the function but it does not work
How did you try changing them? What does "it does not work" mean?
The personal pronoun is capitalized when writing English, particularly
in a newsgroup where lower-case "i" is a common variable name
-------------------- source javascript function --------------- <script type="text/javascript"> function popupOpenen(nummer){ win=window.open("popup.php?formulier=nummer","","t op=275,left=5, width=900px, height=380px, scrollbars=yes"); } </script>
When you include the name of a variable inside quotes, all you are
passing is the name of the variable.
The width and height should not specify units.
There is no need to store the window object in a variable that you
immediately discard:
function popupOpenen(nummer) {
window.open("popup.php?formulier="+nummer,
"",
"top=275,left=5,width=900,height=380,scrollbars=ye s");
} When you include the name of a variable inside quotes, all you are passing is the name of the variable. The width and height should not specify units. There is no need to store the window object in a variable that you immediately discard:
function popupOpenen(nummer) { window.open("popup.php?formulier="+nummer, "", "top=275,left=5,width=900,height=380,scrollbars=ye s"); }
it works now, thanks
Hi all,
Can someone tell me where I'm going wrong?
I have created a function to open a new window on a form submit, The
function opens the new window ok but the window height parameter I've tried
passing to the function just won't work!
Ideally I want to pass the width and height attributes, but being new to JS
I thought I'd make it real simple first...
Code follows
**Form tag
<form action="Processor.php" method="post" target="NewWin" onSubmit="return
!PopForm(875);">
**Function code
function PopForm(h)
{
NewWin = window.open('','NewWin','width=400,height=+h');
NewWin.focus();
}
Any help kindly appreciated
Tobierre
Tobierre wrote on 13 okt 2005 in comp.lang.javascript : NewWin = window.open('','NewWin','width=400,height=+h');
NewWin = window.open('','NewWin','width=400,height='+h);
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
Hi thanks for the code snip..
but could you please explain why the quote goes before the +h so that I know
for future reference?
What happens if I then want to add the width as an argument? I can't do
width='+w so a little explanation would be very much appreciated
Regards
Tobierre
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242... Tobierre wrote on 13 okt 2005 in comp.lang.javascript:
NewWin = window.open('','NewWin','width=400,height=+h');
NewWin = window.open('','NewWin','width=400,height='+h);
-- Evertjan. The Netherlands. (Replace all crosses with dots in my emailaddress)
Tobierre wrote: Hi thanks for the code snip..
Don't top-post to this newsgroup. but could you please explain why the quote goes before the +h so that I know for future reference?
If the 'h' is inside the quotes, it is treated as a literal and you get
an 'h' character. If it is outside the quotes, it is treated as a variable. What happens if I then want to add the width as an argument? I can't do width='+w so a little explanation would be very much appreciated
function PopForm(w, h)
{
NewWin = window.open('','NewWin','width=' + w + '400,height=' + h);
...
Here '+' means concatenate.
[...]
--
Rob
Hi Rob,
Thanks for putting me straight with that great explanation.
P.s I did not mean to top post! purely accidental, but thanks for the
reminder
Tobierre
"RobG" <rg***@iinet.net.au> wrote in message
news:yi*****************@news.optus.net.au... Tobierre wrote: Hi thanks for the code snip..
Don't top-post to this newsgroup.
but could you please explain why the quote goes before the +h so that I know for future reference?
If the 'h' is inside the quotes, it is treated as a literal and you get an 'h' character. If it is outside the quotes, it is treated as a variable.
What happens if I then want to add the width as an argument? I can't do width='+w so a little explanation would be very much appreciated
function PopForm(w, h) { NewWin = window.open('','NewWin','width=' + w + '400,height=' + h); ...
Here '+' means concatenate.
[...]
-- Rob
Tobierre wrote on 14 okt 2005 in comp.lang.javascript : Thanks for putting me straight with that great explanation.
P.s I did not mean to top post! purely accidental, but thanks for the reminder
So, what where you doing now?
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris Beall |
last post by:
If you want your code to be bulletproof, do you have to explicitly check
for the existence of any possibly-undefined variable?
Example: window.outerHeight is defined by some browsers, but not...
|
by: umashd |
last post by:
Hi,
I am doing a web based project for my graduation. I studied bit of java
for backend processesing and javascript for the client. Here is the
scenario.
In the FORM, I use INPUT TYPE=text...
|
by: Russ Chinoy |
last post by:
Hi,
This may be a totally newbie question, but I'm stumped.
If I have a function such as:
function DoSomething(strVarName) {
.....
}
|
by: weston |
last post by:
I've got a piece of code where, for all the world, it looks like this
fails in IE 6:
hometab = document.getElementById('hometab');
but this succeeds:
hometabemt =...
|
by: paul |
last post by:
HI! How do we send a variable from an Iframe page back to its parent?
I have a script that calculates the iframe's window size but I need to know
how to send that value back to its parent so I...
| |
by: gg9h0st |
last post by:
i saw a code refactorying onload event listener
window.onloadListeners=new Array();
window.addOnLoadListener=function(listener) {
window.onloadListeners=listener;
}
why declare the...
|
by: pbmods |
last post by:
VARIABLE SCOPE IN JAVASCRIPT
LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN )
PREREQS: VARIABLES
First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
|
by: Atli |
last post by:
Hi everybody.
This is not so much a problem, since I have already managed to find a solution, but my solution requires the use of the eval() function, which I just hate to use.
The problem is...
|
by: faultykid |
last post by:
I would like to store a variable then call it back later.
I have a variable on line 198
www = ''+this._ad.clickUrl+'';
and on line 321 i try
document.write(www);
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
| |
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: 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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |