I have a function that I call from an HTML page to open a pop-up
window. I would like to make the height and width as parameters but I
jeep getting an "Object Expected" javascript error. I am not a js guru
so I could use a little help. Here si my function:
<script language=javascript>
function popup(filename)
{
var
newWin=window.open(filename,'default','menubar=no, toolbar=no,location=no,directories=no,status=yes,s crollbars=yes,resizable=yes,hotkeys=no,width=400,h eight=150');
newWin.focus();
}
</script>
HTML function call = onClick='popup('service.asp')
The above works fine.
I have tried this but get the error mentioned above:
<script language=javascript>
function popup(filename, p_height, p_width)
{
var
newWin=window.open(filename,'default','menubar=no, toolbar=no,location=no,directories=no,status=yes,s crollbars=yes,resizable=yes,hotkeys=no,width='+p_w idth+',height='+p_height+');
newWin.focus();
}
</script>
HTML function call = onClick='popup('service.asp',500,500)
I assume my syntax is off is some way but I do not know how? Again, all
I want to do is make the height and width as parameters of the function
as I do with the filename. 2 2005
Matt wrote: I have a function that I call from an HTML page to open a pop-up window. I would like to make the height and width as parameters but I jeep getting an "Object Expected" javascript error. I am not a js guru so I could use a little help. Here si my function:
<script language=javascript> function popup(filename) { var newWin=window.open(filename,'default','menubar=no, toolbar=no,location=no,directories=no,status=yes,s crollbars=yes,resizable=yes,hotkeys=no,width=400,h eight=150'); newWin.focus(); } </script>
HTML function call = onClick='popup('service.asp')
The above works fine.
I have tried this but get the error mentioned above:
<script language=javascript> function popup(filename, p_height, p_width) { var newWin=window.open(filename,'default','menubar=no, toolbar=no,location=no,directories=no,status=yes,s crollbars=yes,resizable=yes,hotkeys=no,width='+p_w idth+',height='+p_height+'); newWin.focus();
At the end where you have:
....height='+p_height+');
You have an unterminated string. It should end as follows:
....height=' + p_height);
} </script>
HTML function call = onClick='popup('service.asp',500,500)
I assume my syntax is off is some way but I do not know how? Again, all I want to do is make the height and width as parameters of the function as I do with the filename.
Thank you very much. That worked out great for me. I knew it had to be
my syntax. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael |
last post by:
I am trying to allow a user to view a PDF in a new window. I
currently have this working using the following:
<a href="./pdf.do?parameter=01121980" target="top"><b>pdf</b></a>
The problem...
|
by: alanstew |
last post by:
With the body tag calling out 'window onload', a function with a
'window.open' fails at the 'window.open' line. If I cut out the body
tag, the function executes as normal.
At first I thought it...
|
by: Mike |
last post by:
In my previous post, I wrote:
> ...
> GOAL: (very simple) Provide a hyperlink which, when clicked,
> calls a javascript function which opens a new URL.
> ...
> PROBLEM: The following code...
|
by: Marshall Dudley |
last post by:
When I do the following line in Netscape, the popup loads as it should,
but the parent window usually, but not always, reloads as well.
<a href="#"...
|
by: Samir Pandey |
last post by:
Hello,
I am using the following javascript code to open a new window.
Somehow, IE always opens a new window. It doesn't open target url in
the window name given.
All i want is, if there is a...
|
by: NeverLift |
last post by:
But, if it's not open, I don't want to open it . . . using
window.open will open it if it doesn't exist, even if the url in that
open is null (the window is then empty -- but it's open).
The...
|
by: D. Alvarado |
last post by:
Hello,
I am trying to open a window containing an image and I would like
the image to be flush against the window -- i.e. have no padding or
border. Can I make this happen with a single call to a...
|
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...
|
by: johnsonholding |
last post by:
Here is the code for a pop-up window that works in Firefox and not in
IE - I get a java error or something,
Here is the code :
</script>
<SCRIPT language="JavaScript"...
|
by: Jack |
last post by:
I have a main webpage that has a list of records, each with a link to a
window.open function call. As an example, a page that opens is
editrecord.aspx?RecordID=34, and another is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
| |