PDA

View Full Version : Taking it literally?


SYP}{ER
02-01-2003, 03:10 PM
Alright. I'm making a menu and have the following code to show each layer (each layer has an id):


function show (objToFind,idOfTarget){
var left, top;
offx = 0;
offy = 20;

if (!objToFind.onmouseout) objToFind.onmouseout = function () { hide (idOfTarget); }
what = document.getElementById(idOfTarget);
killTOs(idOfTarget);

if (typeof document.all != 'undefined') {
var textRange = document.body.createTextRange();
textRange.moveToElementText(objToFind);
var textRect = textRange.getClientRects()[0];
left = textRect.left;
top = textRect.top;
scrolll = document.body.scrollTop;
} else if (typeof document.getBoxObjectFor != 'undefined') {
var box = document.getBoxObjectFor(objToFind);
left = box.x;
top = box.y+2;
scrolll = document.documentElement.scrollTop;
}

if (ns4){
what.moveTo(left+offx,top+offy+scrolll);
}else{
what.style.top = top+offy+scrolll + 'px';
what.style.left = left+offx + 'px';
}

if (!what.onmouseover) what.onmouseover = function () { killTOs (idOfTarget); }
if (!what.onmouseout) what.onmouseout = function () { hide (idOfTarget); }
}


Now the last 2 lines of the function are part of my problems (the only part I think I need help fixing).

When I try to alert () the value of what.onmouseout (ie: alert (document.getElementById('homeMenu').onmouseout)) I get "function () { killTOs (idOfTarget); }" in the alert box, minus the quotes of course.

Now I'm wondering, how will it know what idOfTarget is when I mouseOver the object?! I really just want the onmouseout to be, for example, killTOs ('homeMenu');

Any ideas?!

SYP}{ER
02-01-2003, 03:17 PM
Perhaps:


if (what.getAttribute ('onmouseover')=='') what.setAttribute ('onmouseover','killTOs ('+idOfTarget+');');
if (what.getAttribute ('onmouseout')=='') what.setAttribute ('onmouseout','hide ('+idOfTarget+');');


?

lol, no I'm not a skitzo... I just remembered those methods :D

I tried those lines and the menu has come alive some more.

Other suggestions are welcome.

SYP}{ER
02-01-2003, 03:49 PM
Grrr...

http://24.112.99.205/menu/

It doesn't hide itself onmouseout, even though the event is set...

Plus it doesn't help that my browsers aren't shooting any errors out... Neither IE6 NOR mozilla 1.3alpha :(

ARRRG! It doesn't work in IE6! Works half-decent in Moz though...

justame
02-01-2003, 06:33 PM
syp...
/me canttt just a see® whyyy yours wont go back...:O(((
'cept /me uses one n' the contttact stuff looks like just a this®...

//HV Menu- by Ger Versluis (http://www.burmees.nl/)
//Submitted to Dynamic Drive (http://www.dynamicdrive.com)
//Visit http://www.dynamicdrive.com for this script and more

function Go(){return}


</script>
<script type='text/javascript' src='exmplmenu_var.js'>

</script>
<script type='text/javascript' src='menu_com.js'>

</script>


sooo mayyybe ya can gooo there n' just a compare® theirrrs to yours???

just a ps®...:O)))
http://www.dynamicdrive.com/dynamicindex1/hvmenu/index.htm

SYP}{ER
02-01-2003, 10:30 PM
Heh, thanks. But I'd like to make this menu mostly on my own for practice. I've already learned a few tricks along the way. Thing is, the things which should work aren't working which is making this difficult :S