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 11 of 11
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with onmouseover conflict

    Alright, I'm trying to get this website finished within the next 5 hours. I was designing it in such a way that I have some rollover buttons that take me to various parts of the site. Then, I have a gallery page, where I have a simple rollover galley.

    Adding the rollover gallery has stopped my buttons at the top from working.

    First, my .js file

    Code:
    function swap_image(name,source) {
        document.images[name].src=source;
        var argv=swap_image.arguments;
        if(argv[2] && argv[3] && document.getElementById) {
            element=document.getElementById(argv[2]);
            element.innerHTML=argv[3];
            }
        }
    	
    	
    
    if (document.images) {
    image0 = new Image;
    image1 = new Image;
    image2 = new Image;
    image0.src = '/images/male_fem.jpg';
    image1.src = '/images/moon_wmn.jpg';
    image2.src = '/images/mobydick.jpg';
    } else {
    image0 = '';
    image1 = '';
    image2 = '';
    document.rollimg = '';
    }
    
    var cap = ['Picture One',
               'Second Picture',
               'Three'];
    
    function rollover(n) {
    document.rollimg.src = window['image'+n].src;
    document.getElementById('caption').innerHTML = cap[n];
    }
    Now a portion of my html..

    Code:
    <a onmouseover="swap_image('gallery','/images/galleryro.jpg')" onmouseout="swap_image('gallery','/images/galleryhl.jpg')"> 
    <img style = "top:150px; left:160px;" border="0" id="gallery" src="/images/galleryhl.jpg"/> </a>
    
    <a href="timeline.htm" onmouseover="swap_image('timeline','/images/timelinero.jpg')" onmouseout="swap_image('timeline','/images/timeline.jpg')"> 
    <img style = "top:150px; left:175px;" border="0" id="timeline" src="/images/timeline.jpg"/> </a>
    
    <a href="biography.htm"onmouseover="swap_image('biography','/images/biographyro.jpg')" onmouseout="swap_image('biography','/images/biography.jpg')"> 
    <img style = "top:150px; left:190px;" border="0" id="biography" src="/images/biography.jpg"/> </a>
    
    <a href="contact.htm" onmouseover="swap_image('contact','/images/contactro.jpg')" onmouseout="swap_image('contact','/images/contact.jpg')"> 
    <img style = "top:150px; left:205px;" border="0" id="contact" src="/images/contact.jpg"/> </a>
    
    <div class = "lrgimg">
    <p align = "center">
    <img style = "top:150px" src="images/male_fem.jpg" width="auto" height="auto" border="0" alt="large" name="rollimg" />
    </p>
    </div>
    
    
    <div class = "imgbar">
    <p align = "center"><span onmouseover="document.rollimg.src=image0.src;">
    <img style = "top:250px" src="images/male_fem_sm.jpg" width="32" height="32" border="0"alt="malefem"/> </span>
    
    <span onmouseover="document.rollimg.src=image1.src;">
    <img style = "top:250px" src="images/moon_wmn_sm.jpg" width="32" height="32" border="0" alt="moonwmn"/></span>
    
    <span onmouseover="document.rollimg.src=image2.src;">
    <img style = "top:250px" src="images/mobydick_sm.jpg" width="32" height="32" border="0" alt="mobydick"/></span>
    </p>
    </div>
    
    </div>
    Any help to quickly resolve the conflict, would be greatly appreciated. I don't have a lot of time.
    Last edited by lipner12; 12-09-2010 at 09:11 AM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. You can (and should) edit it to make it more meaningful.

    Why must it be done in 5 hours? Is it homework?

  • #3
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, it is homework.

  • #4
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Any help you can provide, would be great.

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    Sounds like duplication of variable and/or function names. I do not see any "buttons at the top".

  • #6
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    all the images above my div class "lrgimg" are the "buttons" I was talking about.

    galleryro.jpg galleryhl.jpg (Since this is a gallery page, I removed the link)

    then we have timeline.jpg, and timelinero.jpg... the rollover happens, and it acts as a link to my timeline.htm

    It's not just the rollover that has stopped. For some reason, adding in the rollover gallery (Which works fine) stops the images from working as links, as well. So I can't even click on any of them. It's very odd.

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    Have you tried using your error console or better still Firebug to detect syntax errors?

  • #8
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Error console? I'm writing everything in notepad++

    I've taken code from other internet sources, but I've fitted it to work, for me.
    I don't have any automated help programs.

    Can you please take a look, and see if there is anything you notice?

  • #9
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    Quote Originally Posted by lipner12 View Post
    Error console? I'm writing everything in notepad++
    Get Firebug!

  • #10
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nevermind, I figured it out without firebug.

    I guess I'm a bit confounded by all the help I've seen on this site, and the complete apathy that has been displayed with regard to my problem.
    Last edited by lipner12; 12-09-2010 at 10:40 AM.

  • #11
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    Quote Originally Posted by lipner12 View Post
    Nevermind, I figured it out without firebug.

    I guess I'm a bit confounded by all the help I've seen on this site, and the complete apathy that has been displayed with regard to my problem.
    You posted in the middle of the night in the USA. Early morning GMT. I guess there are not too many people around in the forums at that time. And frankly some people will perhaps have been put off by "I'm trying to get this website finished within the next 5 hours". There is an obvious retort to that.


  •  

    Posting Permissions

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