SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Zealot matches's Avatar
    Join Date
    Aug 2006
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onmouseover change background image of element

    Hello,

    I am trying to change the background image of an element onmouseover. Just can't seem to get it going. Below is a link to the example that does nothing and the code.

    http://www.servicewhale.com/backgroundSwitch.htm

    Thanks for your help

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    	<head>
    		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    		<title>Untitled Document</title>
    		<style>
    			#wrapper {
    				width: 150px;
    			  height: 331px;
    			  float: left;
    				background: url('grid_box.gif') left top no-repeat;
    			}
    		</style>
    		<script type="text/javascript">
    			 function changeBG(x){
    	        var NewBG = document.getElementById(x);
    	        
    					var highLightBG = "grid_box_highlight.gif" 
    				 
    					NewBG.style.background = highLightBG;
    	    }
    		</script>
    		
    	</head>
    	<body>
    		<div id="wrapper" onmouseover="changeBG('wrapper')">
    			
    		</div>
    		<div id="wrapper" onmouseover="changeBG('wrapper')">
    			
    		</div>
    		<div id="wrapper" onmouseover="changeBG('wrapper')">
    			
    		</div>
    	</body>
    </html>
    Last edited by matches; Aug 28, 2007 at 09:33. Reason: made summery more relevant


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
  •