detonate
detonate

Reputation: 289

onclick="window.open" issues in IE

I'm having a hard time getting this to work in IE. All the other browsers are working perfectly! Can't use a transparent gif because this link is being used inside a cycling background image. If I place a gif, it does not cycle anymore... Anyone suggestions?

<div onclick="window.open('mylink.html','new_window');" style="display:block; float:right; height:40px; width:100px; cursor:pointer;">

Upvotes: 2

Views: 9366

Answers (3)

thedev
thedev

Reputation: 2906

Check your IE settings to see if popups are allowed.

The click event is properly fired in IE 8

demo: http://jsfiddle.net/R249t/

Upvotes: 0

Mitch
Mitch

Reputation: 99

For link, I prefer use the tag <a> :

<a href="mylink.html" target="_blank" style="display:block; float:right; height:40px; width:100px; cursor:pointer;"> Your link </a>

You can even put a picture between <a> <img .... /> </a> Don't forget to add in style : text-decoration:none;

Upvotes: 1

Cfreak
Cfreak

Reputation: 19309

I believe IE still only fires onClick events from elements that are normally clickable.

Do this:

<a href="#" onclick="window.open('mylink.html','new_window'); return false" style="display:block; float:right; height:40px; width:100px; cursor:pointer; text-decoration:none">

(of course use the corresponding </a> instead of </div> at the end)

Not sure what a transparent gif has to do with it.

Upvotes: 2

Related Questions