Simple Javascript rollover effect... or is it?

    Date: 05/11/05 (WebDesign)    Keywords: html, java, web

    Alright, Javascripters of the Web Design community. I'm very, very new to Javascript. So new, that I can't get a simple rollover effect to work. Here's the issue:

    I'm using validated XHTML Strict, which means there are no names, only id's. Firefox doesn't seem to have an issue with this and keeps chugging along without a fix. Internet Explorer doesn't do the rollover, but it also doesn't report an error. Here's my code:

    if (document.images)
    {
    	document.news = new Image(85,30);
    	document.site = new Image(85,30);
    	document.news.src = "images/news1.gif";
    	document.site.src = "images/site1.gif";
    }
    
    function focusOn(imgName) {
    	if (imgName=='news')
    	  document.news.src="images/news2.gif";
    	else if (imgName=='site')
    	  document.site.src="images/site2.gif";
    }
    
    function focusOff(imgName) {
    	if (imgName=='news')
    	  document.news.src="images/news1.gif";
    	else if (imgName=='site')
    	  document.site.src="images/site1.gif";
    }
    


    Any help on this matter will be greatly appreciated, since I have to finish this stupid effect before I go on to more important jobs.

    Source: http://www.livejournal.com/community/webdesign/874143.html

« Link Help || Vertical centering with CSS »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home