I have anchor link with both href and onclick events specified. The onclick sets location.href to server url and href to a other link. When the link is clicked the href event gets called always but onclick event gets called only once (that is only for one anchor link). If i debug javascript it works properly that it calls both href and onclick.What can be the problem?
Try
<a href="whatever.html" onclick='window.location.href="http://whereverelse";return false;'>linky</a>
just to explain: returning false in this case prevents the default action.
Why would you want to do this though?
It sounds like you want the link to call a page that runs server-side code (such as PHP) and then direct the browser to another location. That's typically done by having the server-side script send a redirect response with the second URL.
I wish I had an answer but instead I have the same problem.
<img src="some.php" id="someimage" name="someimage">
<a href="Javascript://" onclick="Javascript:document.getElementById('someimage').src='some.php';" >Change</a>
it works only the first time the link is clicked. Once clicked it wont work again, even if I reload the page. the user needs to close that window and open another one.
Very strange, because it happens in Chrome but IE works fine.
What could it be ?