SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: onMouseover

  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Oklahoma
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onMouseover

    I have an asp.net/vb.net site and i am adding a javascript rollover image. The problem is when i rollover the the images, the main image is asp.net image.

    how can I change the imageURL of the asp.net image in javascript? I read something about adding attributes to the image, but I keep getting the error that the image is not a control or is null?


    Thanks in advanced!
    Last edited by jmls; Jun 10, 2004 at 09:01.

  2. #2
    SitePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you post the image tag code and the JavaScript code you are using that gives the error?

  3. #3
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure if this is exactly what you want...but here is how to swap an image on rollover.

    Code:
    function swapImage(img) {
       // Your image should have the name tag "logoimg"  change if you want
    
       // Define the path to your img directory
       var imgdir = './images/';
    
       // Now change the image
       document.logoimg.src = imgdir + img; 
    }
    Then, for your image:

    Code:
    <img src="./images/logo.jpg" onMouseOver="swapImage('image2.jpg');" onMouseOut="swapImage('logo.jpg');">
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches


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
  •