a button shows multiple times in one page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chinagirl

    a button shows multiple times in one page

    I have a javascript that displays couple of buttons, which are
    directional (e.g., click button it goes to a particular page). I need
    to have these buttons shows up multiple times in same page, each
    represent a different direction but buttons themself are from the same
    gif file. What's the most effecient way to do this? Any info would
    be greatly appreciated.
  • Charles Crume

    #2
    Re: a button shows multiple times in one page

    Hi Chinagirl;

    "chinagirl" <judyhuang@judy hhuang.com> wrote in message
    news:e0ba4f8b.0 405140601.41438 11f@posting.goo gle.com...[color=blue]
    > I have a javascript that displays couple of buttons, which are
    > directional (e.g., click button it goes to a particular page). I need
    > to have these buttons shows up multiple times in same page, each
    > represent a different direction but buttons themself are from the same
    > gif file. What's the most effecient way to do this? Any info would
    > be greatly appreciated.[/color]

    I think the following would be pretty efficient (perhaps others will chime
    in if I'm incorrect).

    // use these statements to create a new image in javascript (this way the
    image only needs
    // to be downloaded from the web once)
    myButton = new Image(76, 21);
    myButton.src = "images/buttonImage2BeU sedMutipleTimes .gif";
    // use these statements load the image on to the page (you will need, of
    course, the proper
    // <img> tags on the page -- and be sure to use the name property)
    document [button_left].src = myButton.src;
    document [button_right].src = myButton.src;
    document [button_up].src = myButton.src;
    document [button_down].src = myButton.src;

    /* sample <img> tag form one of my HTML pages
    <img src="images/contact_off.gif " alt="Contact Info -- How to contact
    us."
    border="0" width="76" height="17" name="contact">
    */

    HTH.

    Charles...



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.684 / Virus Database: 446 - Release Date: 5/13/04


    Comment

    Working...