...

View Full Version : JS Code Question



bound4h
07-22-2009, 11: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>

Philip M
07-23-2009, 08:44 AM
Can JS code allow for tracking whether you've 'clicked' out of the screen to go, say, to another webpage or open another program?



Answer - no.

Are you trying to detect if the user has visited Google in an attempt to find the answer to the questions?

<script language=javascript> is long deprecated and obsolete. Use <script type = "text/javascript"> instead. The <!-- and //--> tags have not been necessary since IE3 and invariably indicate ancient code.


It is your responsibility to die() if necessary….. - PHP Manual

bound4h
07-23-2009, 03:08 PM
Yes, Philip, I want to determine whether the user has looked up the question outside of the current browser window. And you are saying that this is not possible, correct?

Thank you for your help.

Philip M
07-23-2009, 06:22 PM
Yes, Philip, I want to determine whether the user has looked up the question outside of the current browser window. And you are saying that this is not possible, correct?

Thank you for your help.

Yes, not possible.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum