School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,081 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,272 people online right now. Registration is fast and FREE... Join Now!




Problem With Multiple Roll-Overs

 

Problem With Multiple Roll-Overs

thayn

15 Nov, 2006 - 06:28 PM
Post #1

New D.I.C Head
*

Joined: 25 Oct, 2006
Posts: 3


My Contributions
Hi, I was wondering if anyone could help me with my personal website. I am having problems getting my roll-overs to work. I want to code the whole thing by myself but I can't seem to get it to work. If you can take a look at my code and maybe give me some help or suggestions I would appreciate it.

CODE

<script type="text/JavaScript">
<!--
if (document.images)
{
    var defImg = "about";
    
    //About Me Button
    var aboutoff = new Image ();
        aboutoff.src = "aboutme.jpg";
    var abouton = new Image ();
        aboutoff.src = "aboutme_ro.jpg";
    
    //Portfolio Button
    var portfoliooff = new Image ();
        portfoliooff.src = "portfolio.jpg";
    var portfolioon = new Image ();
        portfolioon.src = "portfolio_ro.jpg";
        
    //Printmaking Button
    var printoff = new Image ();
        printoff.src = "printmaking.jpg";
    var printon = new Image();
        printon.src = "printmaking_ro.jpg";
    
    //Intro Projects Button
    var introprojoff = new Image ();
        introprojoff.src = "introprojects.jpg";
    var introprojon = new Image ();
        introprojon.src = :"introprojects_ro.jpg";
        
    //Other Button
    var otheroff = new Image ();
        otheroff.src = "other.jpg";
    var otheron = new Image ();
        otheron.src = "other_ro.jpg";
}

function actMenuItem(imgName)
{
  act(imgName);
  inact(defImg);
}

function inactMenuItem(imgName)
{
  inact(imgName);
  act(defImg);
}

function act(imgName)
{
  if (document.images)
    document.images[imgName].src = eval(imgName + "on.src");
}

function inact(imgName)
{
  if (document.images)
    document.images[imgName].src = eval(imgName + "off.src");
}
//-->
</script>
<body bgcolor="1f1303" onLoad="preloadimages();">
<table width="950" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="images/top_left.jpg" width="50" height="50">
        
        <a href = "aboutme.html">
            <img src = "images/aboutme_ro.jpg"
                name = "about"
                alt = "AboutME"
                border = "0"></a>
        <a href = "portfolio.html"
            onMouseOver = "actMenuItem('portfolio')
            onMouseOut = "inactMenuItem('portfolio')>
            <img src = "images/portfolio.jpg"
                name = "portfolio"
                alt = "Portfolio"
                border = "0"></a>
        <a href = "printmaking.html"
            onMouseOver = "actMenuItem('print')
            onMouseOut = "inactMenuItem('print')>
            <img src = "images/printmaking.jpg"
                name = "print"
                alt = "Printmaking"
                border = "0"></a>
        <a href = "introprojects.html"
            onMouseOver ="actMenuItem('introproj')
            onMouseOut = "inactMenuItem('introproj')>
            <img src = "images/introprojects.jpg"
                name = "introproj"
                alt = "IntroProjects
                border = "0"</a>
        <a href = "other.html"
            onMouseOver = "actMenuItem('other')
            onMouseOut = "inactMenuItem('other)>
            <img src = "images/other.jpg"
                name = "other"
                alt = "OtherStuff"
                border = "0"></a>


User is offlineProfile CardPM
+Quote Post


okyup

RE: Problem With Multiple Roll-Overs

16 Nov, 2006 - 09:08 AM
Post #2

D.I.C Head
Group Icon

Joined: 6 Nov, 2006
Posts: 207


Dream Kudos: 175
My Contributions
What is the problem that you are getting? Did the code work before you added multiple rollovers?

I have not checked the whole code... would like to know what is going wrong. Noticed one typo here...

CODE
//About Me Button
    var aboutoff = new Image ();
        about.src = "aboutme.jpg";
    var abouton = new Image ();
        about[B]off[/B].src = "aboutme_ro.jpg";

User is offlineProfile CardPM
+Quote Post

thayn

RE: Problem With Multiple Roll-Overs

17 Nov, 2006 - 03:33 PM
Post #3

New D.I.C Head
*

Joined: 25 Oct, 2006
Posts: 3


My Contributions
Thank you, well my problem is that it was working with one roll-over but now I can't get it to work with multiple ones. I'm not sure if I am doing something wrong or what and I know it is a lot of code to look through but if you can offer any more help I would definately appreciate it. Thanks for your time!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 10:35AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month