SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Guru coiL's Avatar
    Join Date
    Sep 2001
    Location
    QLD, Australia
    Posts
    666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question combining javascripts

    can I (and how do I) combine
    PHP Code:
    onmouseover="document.contact.src=image5over.src" onmouseout="document.contact.src=image5.src" 
    with
    PHP Code:
    onMouseOver="window.status='text here';return true" OnMouseOut="window.status=''; return true" 
    in the same <a> tag?
    coiL
    "cradled in the learning curve"

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm no expert and I'd prolly mess up the syntax so I won't post any code, but you'd probably put your two onMouseOver JavaScripts in one function and your two onMouseOut scripts in another function then:

    Code:
    onMouseOver="function1()" onMouseOut="function2()"

  3. #3
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, you could do this:

    Code:
    onmouseover="document.contact.src=image5over.src; window.status='text here'; return true;" onmouseout="document.contact.src=image5.src; window.status=''; return true;"
    but I would probably do something more like this:

    Code:
    <script type="text/javascript">
    function foo(x, y, z){
      document[x].src = y.src;
      window.status = z;
      return true;
    }
    </script>
    
    onmouseover="return foo('contact',image5over,'text here');"  onmouseout="return foo('contact', image5, '');"
    ----Adopt-a-Sig----
    Your message here!

  4. #4
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's EXACTLY what I was unable to say!

  5. #5
    SitePoint Guru coiL's Avatar
    Join Date
    Sep 2001
    Location
    QLD, Australia
    Posts
    666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heh could you fill that in?
    I'm a complete javascript noob

    what is x y and z?


    coiL
    "cradled in the learning curve"

  6. #6
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by coiL
    what is x y and z?
    They're parameters.
    You can name them anything you want.
    ----Adopt-a-Sig----
    Your message here!


Bookmarks

Posting Permissions

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