473,382 Members | 1,258 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Pop-up works in IE but fails in Firefox/Opera

Hi Have tweaked a first script together which works fine in IE but
fails in FF/Opera would be grateful for any advise.

Script is as follows:

<script language="JavaScript" type="text/javascript">
function genopenpopup(width,height)
{
if (!width)
width = 900
if (!height)
height = 750
var popurl=event.srcElement.ref
winpops = window.open(popurl,"","width=" + width + ",height=" + height
+ ",scrollbars,resizable,")
if (winpops)
winpops.focus()
}
</script>

Each window coded thus:

<A href="#null" onclick="genopenpopup()" ref="catchments.pdf"
onmouseover="style.cursor='hand'">
9 Secondary School Catchments.</a></td></tr>

If () not specified window set at default of 900x750

Grateful for any feedback

Bob

Jun 3 '07 #1
3 1457
Hi Bob,

In your script you assume that there is a global event variable that
contains the event object. This is true in IE but not all browsers.
The event object is available to the code in the onclick attribute
however so you can do this in IE and other browsers

onclick="genopenpopup(event);"

I would probably write your code something like this...

<script language="JavaScript" type="text/javascript">
function genopenpopup(url, width, height) {
winpops = window.open(url, "",
"width=" + (width||900) +
",height=" + (height||750) +
",scrollbars,resizable,");
if (winpops) {
winpops.focus();
}
}
</script>

Each window coded thus:

<a href="catchments.pdf" onclick="genopenpopup(this.href);return
false;" onmouseover="style.cursor='hand'">
9 Secondary School Catchments.</a>

I don't think you really need to focus winpopus after it is opened. It
will be focused normally. It probably doesn't hurt to focus it
however.

[JavaScript does have automatic semi-colon insertion but it is a good
practice to include them.]

Peter

Jun 5 '07 #2
Peter Michaux said the following on 6/5/2007 5:44 PM:
Hi Bob,
You just earned a <smackfor not quoting!!!!

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 6 '07 #3
On Jun 5, 9:15 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Peter Michaux said the following on 6/5/2007 5:44 PM:
Hi Bob,

You just earned a <smackfor not quoting!!!!
My post was self contained :)

Peter

Jun 6 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Roy Smith | last post by:
In the recent "transforming a list into a string" thread, we've been discussing the fact that list.pop() is O(1), but list.pop(0) is O(n). I decided to do a little timing experiment. To be sure,...
4
by: Andre | last post by:
Hi guys, newbie question. I am having trouble with a script that is supposed to login me to my account on yahoo pop server. When i do this: import getpass, poplib, re POPHOST =...
1
by: spencer | last post by:
Hi, The code. def buildStackMajor(): for node in dirStackMinor: #print 's is the node...', node dirStackMajor.append(node) dirStackMinor.pop() print 'POP the stack...', len(dirStackMinor)...
6
by: Will | last post by:
Hi, Sorry to be a pest... But I can figure this out. I'm pushing to a stack. then I need to check to see if the word is a palindrome. Is the code below correct? if so, how can I check the...
2
by: John Hoge | last post by:
I would like to open an exit pop when a user leaves my site, but I don't want to the back button to trigger the pop if the user remains in my site. I'm using the onUnload attribute of the Body...
15
by: Stig Brautaset | last post by:
Hi group, I'm playing with a little generic linked list/stack library, and have a little problem with the interface of the pop() function. If I used a struct like this it would be simple: ...
11
by: Vijay Kumar R Zanvar | last post by:
> In <pan.2004.04.22.04.06.05.969827@bar.net> "Mac" <foo@bar.net> writes: > > >Is it legal to declare errno after you've included errno.h? > > > >For example: > > > >#include<errno.h> > > >...
25
by: Nicholas Parsons | last post by:
Howdy Folks, I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a...
7
by: Scott | last post by:
As said before I'm new to programming, and I need in depth explaination to understand everything the way I want to know it, call it a personality quirk ;p. With pop() you remove the last element...
20
by: merrittr | last post by:
I need some C advice I want to read in string commands from a user when the user enters a \n I want to push it on the stac. Then at some point , if the user enters the word print pop off and print...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
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...
0
isladogs
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.