bound4h
07-22-2009, 10:12 PM
Hey guys, I have a question about a snippet of JS that I found.
Does the JS (or can JS) code allow for tracking whether you've 'clicked' out of the screen to go, say, to another webpage or open another program?
I would like to try and incorporate some sort of tracking that could identify whether a user has clicked out of the active webpage and onto another. Does this code provide for that?
Thank you
<script language="javascript">
<!--
var playButton = null;
function playIt(itemNum, playBtn, snd, len)
{ playButton = playBtn;
playButton.className = 'played';
playButton.innerHTML = 'Listen...';
var obj = document.getElementById('sndObj');
obj.innerHTML = '<embed id="ply" src="' + snd + '" hidden="true" autostart="true">';
window.setTimeout(donePlaying, len);
}
function donePlaying()
{ playButton.innerHTML = 'Mark the letter of the choice that answers the question.';
var hs = document.getElementById('hs');
hs.className = 'vis';
}
function mc(obj,itm)
{ var ans = obj.innerHTML;
for (var i = 0; i < ans.length; ++i)
{ var ch = ans.substr(i,1);
if (ch < 'A' || ch > 'E') continue;
ans = ch;
break;
}
document.forms.frm.ansr.value = ans;
var spans = document.getElementsByTagName("span");
for (i = 0; i < spans.length; ++i)
{ if (spans[i] === obj)
{ spans[i].style.color = "white";
spans[i].style.backgroundColor = "blue";
}
else
{ spans[i].style.color = "blue";
spans[i].style.backgroundColor = "#d0d0d0";
}
}
}
-->
</script>
Does the JS (or can JS) code allow for tracking whether you've 'clicked' out of the screen to go, say, to another webpage or open another program?
I would like to try and incorporate some sort of tracking that could identify whether a user has clicked out of the active webpage and onto another. Does this code provide for that?
Thank you
<script language="javascript">
<!--
var playButton = null;
function playIt(itemNum, playBtn, snd, len)
{ playButton = playBtn;
playButton.className = 'played';
playButton.innerHTML = 'Listen...';
var obj = document.getElementById('sndObj');
obj.innerHTML = '<embed id="ply" src="' + snd + '" hidden="true" autostart="true">';
window.setTimeout(donePlaying, len);
}
function donePlaying()
{ playButton.innerHTML = 'Mark the letter of the choice that answers the question.';
var hs = document.getElementById('hs');
hs.className = 'vis';
}
function mc(obj,itm)
{ var ans = obj.innerHTML;
for (var i = 0; i < ans.length; ++i)
{ var ch = ans.substr(i,1);
if (ch < 'A' || ch > 'E') continue;
ans = ch;
break;
}
document.forms.frm.ansr.value = ans;
var spans = document.getElementsByTagName("span");
for (i = 0; i < spans.length; ++i)
{ if (spans[i] === obj)
{ spans[i].style.color = "white";
spans[i].style.backgroundColor = "blue";
}
else
{ spans[i].style.color = "blue";
spans[i].style.backgroundColor = "#d0d0d0";
}
}
}
-->
</script>