SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Setting up a connection... mgyth's Avatar
    Join Date
    Nov 2004
    Location
    Mosjøen - Norway
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cant get function to function

    Freinds of ed's Dom Scripting this code should work:
    Code:
    window.onload = prep_bs;
    function prep_bs() {
    	var image = document.getElementById("b9");
    	image.onMouseOver = function() {
    		mouseOver(image);
    
    	}
    }
    function mouseOver(image) {
    	image.setAttribute("src", "./css_images/om_s.jpg");
    }
    If i only put an alert("test") in prep_bs it alerts, so i know the js is loading and running. So theres obviuosly something wrong with my code. but I can't get it to work on my own

    All help appreciated
    www.gwd.no Webdesign.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Javascript is case sensitive.

    onmouseover and mouseover should be all lowercase.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "./css_images/om_s.jpg");
    Are you sure about the pathname?

    And naming a function mouseOver is a little confusing...


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
  •