this is part of the code. I changed the way things are set up thinking that some how having the variable in the wrong place was causing the alert to not show up. But thisis not the case. I tried your code but it still doesn't work.
I'm wondering why I can't just use el.href and call it from the methood...
Code:
var action=new Object();
action.linksclass1=function(e){
var el=window.event&&window.event.srcElement? window.event.srcElement : e&&e.target? e.target : null;
var retry = e.target?e.target.href:e.srcElement.href;
if(el)
alert(el.innerHTML);
return false;
}
action.linksclass2=function(){
document.getElementById("misterioProgram").style.display="block";
alert(retry);
document.embeds["newE"]["src"] =retry ;
But take a look at this. Test this and what you get.
Code:
</head>
<body>
<a href="javascript:void(0)">anchor1</a>
<script type="text/javascript">
var o = document.getElementsByTagName("a")[0];
function clickHandler(e) {
var el=window.event&&window.event.srcElement? window.event.srcElement : e&&e.target? e.target : null;
var retry = el.href;
window.setTimeout("alert(window.retry)", 2000); //Yes, I'm using a string due to laziness
window.setTimeout("alert(retry)", 4000); //Should throw an error
}
(o.addEventListener)?o.addEventListener("click", clickHandler, false):o.attachEvent("onclick", clickHandler);
</script>
</body>
</html>
Bookmarks