»
EnglishFrenchVietnamese

Print - Frame Events script - JavaScriptBank.com

Full version: jsB@nk » Utility » Frame Events script
URL: http://www.javascriptbank.com/frame-events-script.html

Frame Events script © JavaScriptBank.comWatching mouse events in another frame.

Full version: jsB@nk » Utility » Frame Events script
URL: http://www.javascriptbank.com/frame-events-script.html



JavaScript
<script type="text/javascript">var uf_name = 'upper_frame';var lf_name = 'lower_frame';var lf_omm_original = null;window.onload = uf_onload;function uf_onload(){  document.onmousemove = uf_onmousemove;}function lf_onload(){  var doc = top.frames[lf_name].document;  if (doc) {    if (doc.onmousemove) {      lf_omm_original = doc.onmousemove;    }    doc.onmousemove = lf_onmousemove;  }  else {    setTimeout(lf_onload, 250);  }}function lf_load(url){  top.frames[lf_name].location.href = url;  setTimeout(lf_onload, 1000);}function uf_onmousemove(ev){  var e = ev || window.event;  update_form(e, uf_name);}function lf_onmousemove(ev){  if (lf_omm_original) {    lf_omm_original(ev);  }  var e = ev || top.frames[lf_name].event;  update_form(e, lf_name);}function update_form(e, n){  var f = document.forms['f1'];  f.af.value = n;  f.mx.value = e.clientX;  f.my.value = e.clientY;  var t;  t = e.target ? e.target : e.srcElement;  f.te.value = t ? (t.id || t.tagName || t.nodeName || t) : '';}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="f1"><p>Active Frame <input name="af" type="text" size="20"></p><p>Mouse X <input name="mx" type="text" size="20"></p><p>Mouse Y <input name="my" type="text" size="20"></p><p>Target Element <input name="te" type="text" size="20"></p></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->