Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Safari and onblur 1

Status
Not open for further replies.

jimmyshoes

Programmer
Jun 1, 2008
132
0
0
GB
Hi

The following code works in ff and ie but in Safari onblur will not fire on an anchor ( although it works on a textbox). Is there a workaround?

Code:
<a href="a.com" onclick="return false;" onblur="alert('blur')">lnk</a>
 
Hi

Just to clarify, you want this :
[ul]
[li]You activate the link - nothing happens[/li]
[li]After activating the link you move the focus elsewhere - the [tt]alert()[/tt] message appears[/li]
[/ul]
Well, I have no Safari, but your code works in Epiphany, Midori and Arora ( all powered by the same WebKit layout engine ).

However, I noticed an interesting behavior in Arora : when is activated with mouse, it not gets the focus. ( With keyboard it works as described above. )

If this is the same problem you tried to describe, try the following. This makes Arora to behave like the other browsers :
Code:
[b]<a[/b] [maroon]href[/maroon][teal]=[/teal][green][i]"a.com"[/i][/green] [maroon]onclick[/maroon][teal]=[/teal][green][i]"[highlight]this.focus();[/highlight]return false;"[/i][/green] [maroon]onblur[/maroon][teal]=[/teal][green][i]"alert('blur')"[/i][/green][b]>[/b]lnk[b]</a>[/b]
If I misunderstood you please try to describe your goal.

Feherke.
 
That's solved the problem. I'm running Safari on Windows (to test my displays). All works great now. Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top