Import Javascript effect into html body

Discussion in 'HTML' started by Viabug123, Apr 21, 2006.

  1. Viabug123

    Viabug123 Guest

    I have an effect of changing images in javascript. When mouse over
    image1, it changes to image2.
    But I don't know how to import the above javascript effect in the body
    of html, so that I can design the html page. There is no function of
    <body onmouseover="function();...>. Could anyone suggest me any ideas
    to solve it? Thanks a lot.


    onMouseOver="handlePress();return true;"
    onMouseUp="handleRelease();return true;"
    ....
    if (document.images) {
    img_on =new Image(); img_on.src ="image/1.gif";
    img_off=new Image(); img_off.src="image/2.gif";
    }

    function handlePress() {
    if (document.images) document.imgName.src=img_on.src;
    }

    function handleRelease() {
    if (document.images) document.imgName.src=img_off.src;
    }
     
    Viabug123, Apr 21, 2006
    #1
    1. Advertising

  2. Viabug123

    Neredbojias Guest

    To further the education of mankind, "Viabug123" <>
    vouchsafed:

    > I have an effect of changing images in javascript. When mouse over
    > image1, it changes to image2.


    Do you want it to change back to image1 when you mouseout? If so, you
    could use just css.

    > But I don't know how to import the above javascript effect in the body
    > of html, so that I can design the html page. There is no function of
    > <body onmouseover="function();...>. Could anyone suggest me any ideas
    > to solve it? Thanks a lot.


    Your javascript examples were very old and outdated. Best check with the
    newsgroup "comp.lang.javascript" for advice. What you want to do is
    actually pretty simple but you need to know something about the current
    DOM.

    --
    Neredbojias
    Infinity has its limits.
     
    Neredbojias, Apr 21, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dude718
    Replies:
    3
    Views:
    537
    Srinivasa Reddy K Ganji
    Aug 1, 2003
  2. Dhanasankar S via DotNetMonster.com

    How to read the BODY of HTML file from another HTML file using javascript?

    Dhanasankar S via DotNetMonster.com, Feb 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    471
    =?Utf-8?B?dHBlcnJp?=
    Feb 28, 2005
  3. asrahma1111
    Replies:
    11
    Views:
    1,384
    Chris Smith
    May 1, 2004
  4. London Boy
    Replies:
    2
    Views:
    334
    Keith Bowes
    Jan 12, 2004
  5. Replies:
    5
    Views:
    213
    A. Sinan Unur
    Sep 8, 2005
Loading...

Share This Page