...

View Full Version : I need some easy help



Striker14537
10-12-2006, 10:33 PM
Ok I have a div with a class.
<div class="pic" style="width:140px;">

And I have this onmouseover and onmouseout code.

onMouseover="ddrivetip('Tooltip','yellow', 300)";
onMouseout="hideddrivetip()"

How would I write a function that lauches the tooltip everytime I go over that div?

Something like...
<script>
function picthediv() {
if(onmouseover pic) {
document.write('onMouseover="ddrivetip('Tooltip','yellow', 300)"; onMouseout="hideddrivetip()"');')
}
}
</script>

Help me! I'm so lost, I feel like I'm dumb!

VortexCortex
10-13-2006, 01:34 AM
<div class="pic" style="width:140px;" onmouseover="ddrivetip('Tooltip','yellow', 300)" onmouseout="hideddrivetip()" >

Striker14537
10-13-2006, 01:50 AM
Let me explain. I want to call a function that does it. I don't want to do it directly. I think you have to use:

getElementsByClassName(document.getElementById("pic1"), "div", "pic");
and then something else... I'm stumped.... Homework stinks. I just want to know how to call the mouse over from there. Thank you Vortex, but that wasn't it.

1212jtraceur
10-13-2006, 06:03 AM
Lemme get this straight. When the user mouses over div.pic, you want to call ddrivetip(), which calls another function. If so, here is the code.

JS:


function ddrivetip(a, b, c)
{
anotherFunction(a, b, c);
}

function anotherFunction(a, b, c)
{
<!-- Whatever you want to do... //-->
}


HTML


<div class="pic" style="width:140px;"
onmouseover="ddrivetip('Tooltip','yellow', 300)"
onmouseout="hideddrivetip()" >


Hope this helps :-)
1212jtraceur

Striker14537
10-13-2006, 11:18 AM
Thank you, but what I am trying to do is write a function. The function should call the onmouseover and onmouseout.

function functiondiv() {
if(onmouseover) {
}
}

Get it?

Kor
10-13-2006, 11:30 AM
onload=function(){
var divs=document.getElementsByTagName('div');
var i=0, d
while(d=divs[i++]){
if(d.className=='pic'){
d.onmouseover=function(){ddrivetip('Tooltip','yellow', 300)}
d.onmouseout=function(){hideddrivetip()}
}
}
}

Striker14537
10-13-2006, 08:29 PM
Thank you! I'll try it! Both of you are amazing! :thumbsup: :thumbsup: 2 thumbs up!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum