471,055 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,055 software developers and data experts.

trying to use mouse effect script in multiple frames?

ids
I have my own website and i want to use a mouse effect.
My problem is that i use frames and when i put the javascript in the index.html like this:

<html>

<head>
<meta name="keywords" content="vacation">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Vacation</title>
</head>

<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
var brOK = false, mie = false;
if (document.layers || document.all) brOK = true;
if (document.all) mie = true;
var ex = 0, ey = 0;
var ae, le, re, x0, y0, tid, realx, realy;
function navMove(e) {
ex = e.pageX;
ey = e.pageY;
moveeye()
return routeEvent(e);
}
function mieMove() {
ex = document.body.scrollLeft + event.x;
ey = document.body.scrollTop + event.y;
moveeye();
}
function moveeye() {
dy = ey - y0 - 20;
dx1 = ex - x0 - 20;
dx2 = ex - x0 - 60;
r = Math.sqrt(dx1 * dx1 + dy * dy);
if (r < 20) r = 20;
dx1 = dx1 * 10 / r + x0 + 10;
dy1 = dy * 10 / r + y0 + 10;
r = Math.sqrt(dx2 * dx2 + dy * dy);
if (r < 20) r = 20;
dx2 = dx2 * 10 / r + x0 + 50;
ae.left = x0;
ae.top = y0;
le.left = dx1;
le.top = dy1;
re.left = dx2;
re.top = dy1;
}
function setHandlers() {
if (!mie) {
y0 = document.eyeballs.top;
x0 = document.eyeballs.left;
ae = document.eyeballs;
le = document.lefteye;
re = document.righteye;
window.captureEvents(Event.MOUSEMOVE);
window.onMouseMove = navMove;
}
else {
y0 = document.all.eyeballs.style.pixelTop;
x0 = document.all.eyeballs.style.pixelLeft;
ae = document.all.eyeballs.style;
le = document.all.lefteye.style;
re = document.all.righteye.style;
window.document.onmousemove = mieMove;
}
realx = x0 + 0.1;
realy = y0 + 0.1;
moveall();
}
function moveall() {
rx = realx + 40;
ry = realy + 40;
rx += (ex - rx) * 0.1;
ry += (ey - ry) * 0.1;
realx = rx - 40;
realy = ry - 40;
x0 = Math.round(realx);
y0 = Math.round(realy);
moveeye();
tid = setTimeout('moveall()', 100);
}
function placeeyes(x, y) {
if (brOK) {
ex = x + 40;
ey = y + 40;
s = '<DIV ID ="dummy" STYLE="position:absolute; ' +
'top:'+y+'; left:'+x+'; width:10; height:10;"> </DIV>';
s += '<DIV ID="eyeballs" STYLE="position:absolute; ' +
'top:'+y+'; left:'+x+'; width:80; height:40;"><IMG SRC=' +
'"whites.gif" border=0></DIV>';
// remember to get the image dir correct... for both whites.gif and pupil.gif
s += '<DIV ID="lefteye" STYLE="position:absolute; ' +
'top:'+(y+10)+'; left:'+(x+10)+'; width:20; height:20;">' +
'<IMG SRC="pupil.gif" border=0></DIV>';
s += '<DIV ID="righteye" STYLE="position:absolute; ' +
'top:'+(y+10)+'; left:'+(x+50)+'; width:20; height:20;">' +
'<IMG SRC="pupil.gif" border=0></DIV>';
document.writeln(s);
}
}
function clearEyes() {
if (tid) clearTimeout(tid);
}
placeeyes(200, 100);
window.onload = setHandlers;
window.onunload = clearEyes;
// End -->
</script>

<frameset rows="94,*" framespacing="0" border="0" frameborder="0">
<frame name="vaandel" scrolling="no" target="inhoud" src="top.html" marginwidth="0" marginheight="0" style="word-spacing: 0; margin: 0">
<frameset cols="142,*">
<frame name="inhoud" target="hoofd" src="left.html" scrolling="auto" marginwidth="0" marginheight="0">
<frameset rows="*,95%">
<frameset cols="*,10%">
<frame name="datum" src="datum.html" scrolling="no" target="_self" noresize marginwidth="0" marginheight="0">
<frame name="tijd" scrolling="no" noresize marginwidth="0" marginheight="0" src="tijd.html">
</frameset>
<frame name="hoofd1" target="_self" src="hoofd.html">
</frameset>
</frameset>
<noframes>
<body topmargin="0" leftmargin="0">

<p>Op deze pagina worden frames gebruikt, maar uw browser ondersteunt geen
frames.</p>

</body>
</noframes>
</frameset>

</html>


I don't see the frames anymore.
I only see the mouse effect.
Where do i have to put the javascript so that it will work for all frames?
Even when i load a new html in a frame?
I mean it has to stay there as a layer over my website.

Thanks in advance...
Jul 23 '05 #1
1 1728
ids schrieb:
I have my own website and i want to use a mouse effect.
My problem is that i use frames and when i put the javascript in the index.html like this:
[alotofcode]
I don't see the frames anymore.
I only see the mouse effect.
Where do i have to put the javascript so that it will work for all frames?
Even when i load a new html in a frame?
I mean it has to stay there as a layer over my website.


It's not possible to place an element on top of frames. However, you may
use IFrames within your document.

Daniel
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Catherine Lynn Smith | last post: by
4 posts views Thread by Larry R Harrison Jr | last post: by
4 posts views Thread by Prateek | last post: by
4 posts views Thread by Fokke Nauta | last post: by
1 post views Thread by yerk5 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.