473,414 Members | 1,888 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,414 software developers and data experts.

ONCLICK event not firing in IE6

Hi,

I've been reading through tons of posts regarding the problems people
have encountered with getting javascript functions to trigger when
called from onclick events... But so far, I haven't found a solution
that works for me...

I am trying to launch a popup window when the user clicks on an image.

I have managed to get this to work in IE6 by using an image button
(ASP.NET), but this failed in Netscape.
I can now get it to work in Netscape by triggering the window.open
command from the onclick event attached to an <IMG> or <A> tag.

But, this doesn't work in IE6.

The code:

<a href="" onclick="openFullWindow();return false;"><IMG
src="img/space vase web button.jpg"></a>

DOES NOT work in IE6. the HREF parameter is not ignored due to the
'return false;' command... The browser reloads the current page (as
expected) but the javascript procedure 'openFullWindow()' is never
called.

Can anyone provide a solution to my problem?

I'm kind of new to all these languages...

Thanks,

Nick
Jul 23 '05 #1
7 14263
ni**************@ntlworld.com (Nick72) writes:
The code:

<a href="" onclick="openFullWindow();return false;"><IMG
src="img/space vase web button.jpg"></a>

DOES NOT work in IE6. the HREF parameter is not ignored due to the
'return false;' command...


That symptom suggests an error in the OpenFullWindow function. If
there is a Javascript error prior to the execution of "return false",
then false is not returned and the link is followed as normal.

Are there any error messages? (You have set IE to display Javascript
errors, right? <URL:http://jibbering.com/faq/#FAQ4_43>).

/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.'
Jul 23 '05 #2
Doh! In the tradition of 'only finding the problem once you've asked a
question on usenet!', I discovered the prob as soon as I hit submit in
google!

You were right... The problem was that I had assigned a 'name' parameter
to the window I was creating using window.open in the openFullWindow()
procedure.

I removed it and hey presto! it all works...
I don't know why this should have caused a problem, as I read somewhere
that it was a good idea to always name the windows... ?!?!

Thanks for your reply,

Nick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
nick lankester <ni**************@ntlworld.com> writes:
You were right... The problem was that I had assigned a 'name' parameter
to the window I was creating using window.open in the openFullWindow()
procedure.

I removed it and hey presto! it all works...
I don't know why this should have caused a problem, as I read somewhere
that it was a good idea to always name the windows... ?!?!


Did your name contain a space?

The window.open function is documented to required the first two
arguments:
<URL:http://www.mozilla.org/docs/dom/domref/dom_window_ref76.html#1019331>
In IE, all arguments are optional, but apparently not in Gecko based
browsers.

If you don't plan on reusing the window, opening other links into the
same window, then you don't need to give it a name. You can then just
give "_blank" as the name argument to the function. That will create
a new, unnamed window.

/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.'
Jul 23 '05 #4
Ahh, yes... That must have been the problem.

A short name with no spaces works fine...
Can you recommend any books or websites that I can use as a reference
that contain this kind of information?

At the moment I'm learning by studying other sites, which is sloooow
going!

Thanks again,
Nick
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #5
Otherwise you could use <a href="javascript:void(openFullWindow())">blah</a>
"nick lankester" <ni**************@ntlworld.com> wrote in message
news:40*********************@news.frii.net...
Ahh, yes... That must have been the problem.

A short name with no spaces works fine...
Can you recommend any books or websites that I can use as a reference
that contain this kind of information?

At the moment I'm learning by studying other sites, which is sloooow
going!

Thanks again,
Nick
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 23 '05 #6
Chris wrote:
Otherwise you could use <a href="javascript:void(openFullWindow())">blah</a>


http://www.jibbering.com/faq/#FAQ4_24

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #7
In article <40*********************@news.frii.net>,
nick lankester <ni**************@ntlworld.com> wrote:
Ahh, yes... That must have been the problem.

A short name with no spaces works fine...
Can you recommend any books or websites that I can use as a reference
that contain this kind of information?

http://www.jibbering.com/faq/#FAQ3_1
Reads:

3.1 What books cover javascript?

The only book currently endorsed by c.l.j. regulars is: javascript: The
Definitive Guide, 4th Edition By David Flanagan ISBN:0-596-00048-0

(Also by David Flanagan: JavaScript Pocket Reference, 2nd Edition. ISBN
0-596-00411-7 for language and API reference alone).

http://www.oreilly.com/catalog/jscript4/

Robert
Jul 23 '05 #8

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

Similar topics

2
by: alien2_51 | last post by:
Can some one tell me why the onclick is firing twice for the radion button and checkbox controls...? <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb"...
13
by: Chris | last post by:
I can create Javascript confirm message boxes during page creation, etc adding them to the button attributes (many good posts on this!). But how can I add this event after the button is pressed? I...
5
by: Michel | last post by:
Hi Group of helpers, Following snippet of code: <HTML> <HEAD> <script> function color(value) { alert(value);
2
by: dave.wayne | last post by:
In a web page I have a div tag that has a onlick event registered through the event listener. However, that same div tag also has a onmousedown - start a drag and drop script The problem I am...
17
by: dan_williams | last post by:
I have the following test web page:- <html> <head><title>Test</title> <script language="Javascript"> <!-- function fnTR() { alert("TR"); }
2
by: =?Utf-8?B?Uml0YUc=?= | last post by:
I posted this question in the C# discussion group but am posting it here also since ASP is involved. I'm new to C# and need some help regarding an onClick event not firing. I have a data grid...
7
by: Moses | last post by:
Hi Everybody, I have a problem with onClick event which works in FF and does not work in IE, Here I have giving the details Please help. I am creating a <aTag. dom_obj =...
21
by: brucedodds | last post by:
I have an Access 2003 form bound to a SQL Server table via ODBC. Often clicking a button on the form has the effect of requerying the form rather than firing the OnClick event. Does anyone have...
9
by: skultetc | last post by:
Hey all, I have a div displayed as a block with an onclick event that shows/ hides a different div underneath it. There is a link within the first div that takes the user to a different page. My...
3
by: ndeeley | last post by:
Hi, I've got a link nested inside a form which, when clicked, should open a new window. Whilst it's doing this it also opens the page in the existing parent window as well. I didn't write the...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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,...
0
isladogs
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...
0
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 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.