Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Javascript Button

Posted on 1998-09-08
3
167 Views
Last Modified: 2010-04-09
Hello Expert!!!
---------------
How can i make button ho changes picture when i put mouse over the button. I have seen javascript when i look at the source of the page. Can i use FrontPage98 ?

Help!!!
Thanks...
0
Comment
Question by:mummi
  • 2
3 Comments
 
LVL 1

Expert Comment

by:rcashon
ID: 1837434
mummi,
    A little more information is needed. Are you trying to create a button/image rollover? Ie. change the image of the button when the mouse is over it?

Randall
0
 
LVL 10

Accepted Solution

by:
MasseyM earned 50 total points
ID: 1837435
This is very simple.  Please see the code below:

0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1837436
roll.js // I have this function in a separate "script" file so that I can use it with all my pages... Below this is a sample page.
-----------------------------------------------------
function imgOn(imgName) {
   if (document.images) {
       document[imgName].src = eval(imgName + "on.src");
        }
}

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



INDEX.HTML
-----------------------------------------------------
<HTML>
      <HEAD>
            <TITLE>Lathon Wider Community Center</TITLE>
      </HEAD>

<BODY BACKGROUND="Graphics/SideTear.Gif">
      <SCRIPT LANGUAGE="JavaScript">
      img1on = new Image();           // Active images
      img1on.src = "graphics/on.gif";  
      img2on = new Image();
      img2on.src = "graphics/on.gif";  
      img3on = new Image();
      img3on.src = "graphics/on.gif";

      img1off = new Image();          // Inactive images
      img1off.src = "graphics/off.gif";
      img2off = new Image();
      img2off.src = "graphics/off.gif";
      img3off = new Image();
      img3off.src = "graphics/off.gif";

      </SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="roll.js">

</SCRIPT>

      <STYLE>
            A      {
                  text-decoration: none;
                  }
      </STYLE>

<TABLE CELLPADDING=-10 CELLSPACING=-10 WIDTH="100%">
<TR>
      <TH WIDTH="15%"></TH><TH></TH>
</TR>
      <TR>
            <TD>
                  <TABLE CELLSPACING=-10 CELLPADDING=-10>
                        <TR>
                              <TD><IMG SRC="Graphics/CTE_logo.Gif"></TD>
                        </TR>
                  </TABLE>
            </TD>
            <TD VALIGN="TOP">
                  <TABLE CELLSPACING=-10 CELLPADDING=-10 WIDTH=100% BORDER=2>
                        <TR  VALIGN="TOP">
                              <TD VALIGN = "TOP" BGCOLOR="NAVY"><FONT SIZE="+3" COLOR="WHITE"><B>Lathon Wider Community Center</B></FONT></TD>
                        </TR>
                  </TABLE>
                  <TABLE>
                        <TR>
                              <TD><A HREF="toc.asp" onMouseOver = "imgOn('img1');" onMouseOut="imgOff('img1');"><IMG NAME="img1" SRC="graphics/off.gif" BORDER=0><FONT SIZE=+1>1997-1998 Program Guide</FONT></A></TD>
                              </TD>
                        </TR>

                        <TR>
                              <TD><A HREF="about.asp" onMouseOver = "imgOn('img2');" onMouseOut="imgOff('img2');"><IMG NAME="img2" SRC="graphics/off.gif" BORDER=0><FONT SIZE=+1>About Us</FONT></A></TD>
                              </TD>
                        </TR>
                        <TR>
                              <TD><A HREF="about2.asp" onMouseOver = "imgOn('img3');" onMouseOut="imgOff('img3');"><IMG NAME="img3" SRC="graphics/off.gif" BORDER=0><FONT SIZE=+1>About Us</FONT></A></TD>
                              </TD>
                        </TR>


                  </TABLE>
            </TD>
      </TR>
</TABLE>
</BODY>
<ADDRESS>
      <TABLE CELLPADDING=-10 CELLSPACING=-10 WIDTH="100%">
            <TR>
                  <TH WIDTH="15%"></TH><TH></TH>
            </TR>
            <TR>
                  <TD></TD>
                  <TD><HR></TD>
            </TR>
            <TR>
                  <TD></TD>
                  <TD><FONT COLOR="NAVY" SIZE=-1>137 Henry Street</FONT></TD>
            </TR>
            <TR>
                  <TD></TD>
                  <TD><FONT COLOR="NAVY" SIZE=-1>Stamford, Connecticut  06902</FONT></TD>
            </TR>
            <TR>
                  <TD></TD>
                  <TD><FONT COLOR="NAVY" SIZE=-1>(203) 327-3260</FONT></TD>
            </TR>
      </TABLE>
</ADDRESS>
</HTML>
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question