By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

ONCLICK event not firing in IE6

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.