Web Analytics Made Easy -
StatCounter I need some easy help - CodingForum

Announcement

Collapse
No announcement yet.

I need some easy help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    PHP Code:
    <div class="pic" style="width:140px;" onmouseover="ddrivetip('Tooltip','yellow', 300)" onmouseout="hideddrivetip()" 

    Comment


    • #3
      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; Oct 12, 2006, 09:53 PM.

      Comment


      • #4
        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

        Comment


        • #5
          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?

          Comment


          • #6
            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
            -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

            Comment


            • #7
              Thank you! I'll try it! Both of you are amazing! 2 thumbs up!

              Comment

              Working...
              X