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. Advertisements

  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. Advertisements

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. Rick Spiewak
    Replies:
    5
    Views:
    1,046
    Lewis Wang [MSFT]
    Aug 1, 2003
  2. dude718
    Replies:
    3
    Views:
    597
    Srinivasa Reddy K Ganji
    Aug 1, 2003
  3. 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:
    610
    =?Utf-8?B?dHBlcnJp?=
    Feb 28, 2005
  4. asrahma1111
    Replies:
    11
    Views:
    1,695
    Chris Smith
    May 1, 2004
  5. dave
    Replies:
    1
    Views:
    857
    Aaron [SQL Server MVP]
    Jul 14, 2004
  6. London Boy
    Replies:
    2
    Views:
    489
    Keith Bowes
    Jan 12, 2004
  7. Replies:
    5
    Views:
    415
    A. Sinan Unur
    Sep 8, 2005
  8. Jens Thoms Toerring

    Strange effect with import

    Jens Thoms Toerring, Dec 20, 2012, in forum: Python
    Replies:
    9
    Views:
    235
    Jens Thoms Toerring
    Dec 21, 2012
Loading...