Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I need some easy help

    Ok I have a div with a class.
    <div class="pic" style="width:140px;">

    And I have this onmouseover and onmouseout code.
    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!

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    <div class="pic" style="width:140px;" onmouseover="ddrivetip('Tooltip','yellow', 300)" onmouseout="hideddrivetip()" 

  • #3
    New Coder
    Join Date
    Oct 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:
    Code:
    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.
    Last edited by Striker14537; 10-13-2006 at 01:53 AM.

  • #4
    Regular Coder
    Join Date
    Oct 2006
    Posts
    206
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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:
    Code:
    function ddrivetip(a, b, c)
    {
    anotherFunction(a, b, c);
    }
    
    function anotherFunction(a, b, c)
    {
    <!-- Whatever you want to do... //-->
    }
    HTML
    Code:
    <div class="pic" style="width:140px;" 
    onmouseover="ddrivetip('Tooltip','yellow', 300)" 
    onmouseout="hideddrivetip()" >
    Hope this helps :-)
    1212jtraceur

  • #5
    New Coder
    Join Date
    Oct 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Code:
    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()}
    }
    }
    }
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    New Coder
    Join Date
    Oct 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you! I'll try it! Both of you are amazing! 2 thumbs up!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •