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;">
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;">
Share
Improve this question
asked Mar 16, 2011 at 18:37
detonatedetonate
2893 gold badges11 silver badges21 bronze badges
4
- sad you're not having issues in all browsers... – jondavidjohn Commented Mar 16, 2011 at 18:43
- Describe what is happening, in detail. – Lightness Races in Orbit Commented Mar 16, 2011 at 18:43
- what IE version are we talking about ? – thedev Commented Mar 16, 2011 at 18:50
- I'm creating a Div container so it can look like I'm clicking on a portion of my background image. It all works well except for IE (of course). – detonate Commented Mar 16, 2011 at 18:52
3 Answers
Reset to default 2I 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.
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;
Check your IE settings to see if popups are allowed.
The click event is properly fired in IE 8
demo: http://jsfiddle/R249t/
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744715025a4589566.html
评论列表(0条)