Can anyone help with my javascript code please?
I have a button which when pressed calls a function named 'popjack'
which pops up a new browser window. The function is called with a
paramter 'printflag' and I want to assign the value of this to a
variable 'var1' in the url of the browser window to be opened.
Here is my code below, but 'var1=' part is wrong, can anyone help
please. Many thanks.
Rob.
<script language="JavaScript">
function popjack(printflag){
window.open('myfile.php?var1=printflag','popjack1' ,
'toolbar=no,location=no,width=650,height=534');
}
</script>
<button class=button onClick="javascript: popjack(1)"> Print
Waybill</button> 3 1813 ro******@hotmail.com said: Can anyone help with my javascript code please?
I have a button which when pressed calls a function named 'popjack' which pops up a new browser window. The function is called with a paramter 'printflag' and I want to assign the value of this to a variable 'var1' in the url of the browser window to be opened.
Here is my code below, but 'var1=' part is wrong, can anyone help please. Many thanks.
Rob.
<script language="JavaScript">
function popjack(printflag){
window.open('myfile.php?var1=printflag','popjack1 ', 'toolbar=no,location=no,width=650,height=534');
window.open('myfile.php?var1='+printflag,'popjack1 ',
'width=650,height=534,resizeable');
toolbar and location are "no" by default if you specify
any attributes. Popups shold always be resizable because
you don't know what the user might have done with font size.
Lee <RE**************@cox.net> writes: window.open('myfile.php?var1='+printflag,'popjack1 ', 'width=650,height=534,resizeable');
This works if the string passed as "printflag" contains only
characters valid in a URL. Otherwise, it would be safest
to escape the string. For a URL simulating a GET request,
that means using the "escape" function, and also turning
spaces into plusses (that's what posting a form would do):
printflag = escape(printflag).replace(/[ ]/g,"+");
toolbar and location are "no" by default if you specify any attributes. Popups shold always be resizable because you don't know what the user might have done with font size.
Hear, hear!
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Lasse Reichstein Nielsen wrote: Lee <RE**************@cox.net> writes: window.open('myfile.php?var1='+printflag,'popjack1 ', 'width=650,height=534,resizeable');
This works if the string passed as "printflag" contains only characters valid in a URL. Otherwise, it would be safest to escape the string. For a URL simulating a GET request, that means using the "escape" function, and also turning spaces into plusses (that's what posting a form would do):
printflag = escape(printflag).replace(/[ ]/g,"+");
This will not work as supposed, as the spaces are already
converted to `%20' by escape(). The following should work:
printflag = escape(printflag).replace(/%20/g,"+");
Or consider this:
printflag = escape(printflag.replace(/ /g, "+"));
I also wonder why you used a character class only for a
space character.
PointedEars This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bryan Ashby |
last post by:
All,
I'm looking for a way to define a "dummy" variable in JavaScript;
specifically for the window object. I would like to define a window
object that would normally be generated with...
|
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: nescio |
last post by:
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...
|
by: Joe Molloy |
last post by:
Hi,
This isn't a mission critical question but I thought I'dl throw it out there
for your feedback as it's a bit curious.
I have developed a shopping cart for an application I'm working on...
|
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: ntdude4 |
last post by:
I am trying to make a variable link on a page. The page has a text box
for a stock symbol. The code is: <input type=TEXTBOX Name="symtb"
value="" size="10>
The value of the text box {the stock...
|
by: rockdale |
last post by:
Hi, all:
I have a linkbutton and I use javascript to open another webpage in a
new window. I also want to set my session variable value when this
linkbutton get clicked. These session variable...
|
by: Skip |
last post by:
OK, I'm a novice in JS but have lots of coding experience. I am
trying to accomplish something that would seem somewhat simple - BUT
IT'S NOT.
I have a basic window that calls another window...
|
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: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |